diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /cmake/modules/buildtools/FindIncludeWhatYouUse.cmake | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/buildtools/FindIncludeWhatYouUse.cmake')
-rw-r--r-- | cmake/modules/buildtools/FindIncludeWhatYouUse.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake b/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake new file mode 100644 index 0000000..b22225a --- /dev/null +++ b/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake @@ -0,0 +1,26 @@ +#.rst: +# FindIncludeWhatYouUse +# --------------------- +# Finds include-what-you-use and sets it up to run along with the compiler for C and CXX. + +find_program(IWYU_EXECUTABLE NAMES include-what-you-use iwyu) + +if(IWYU_EXECUTABLE) + execute_process(COMMAND "${IWYU_EXECUTABLE}" --version + OUTPUT_VARIABLE IWYU_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "[^\n]*include-what-you-use [^\n]*" IWYU_VERSION "${IWYU_VERSION}") + string(REGEX REPLACE "include-what-you-use ([^ \n\r\t]+).*" "\\1" IWYU_VERSION "${IWYU_VERSION}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(IncludeWhatYouUse REQUIRED_VARS IWYU_EXECUTABLE + VERSION_VAR IWYU_VERSION) + +if(INCLUDEWHATYOUUSE_FOUND) + # Supports Unix Makefiles and Ninja + set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE) + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE) +endif() + +mark_as_advanced(IWYU_EXECUTABLE) |