diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-27 16:09:07 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-27 16:09:07 (GMT) |
commit | 25f0b4f397255dfb235d285bd391536a1fe8fe8c (patch) | |
tree | e7e55f6023b96097d3a7d10bdab697a2f4f346ed | |
parent | 7ac338be9830bdc936b52a4135504ed011418f3c (diff) | |
download | CMake-25f0b4f397255dfb235d285bd391536a1fe8fe8c.zip CMake-25f0b4f397255dfb235d285bd391536a1fe8fe8c.tar.gz CMake-25f0b4f397255dfb235d285bd391536a1fe8fe8c.tar.bz2 |
CMake: add an option to run IWYU in verbose mode
This helps to diagnose places where IWYU asks to include headers for
internal stdlib details.
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | Utilities/IWYU/mapping.imp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0485b04..d11b4cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,11 @@ if(CMake_RUN_IWYU) endif() set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w") + option(CMake_IWYU_VERBOSE "Run include-what-you-use in verbose mode" OFF) + if (CMake_IWYU_VERBOSE) + list(APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE + -Xiwyu -v7) + endif () list(APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${CMake_IWYU_OPTIONS}) endif() diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index b0ed911..0ba2f51 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -76,7 +76,7 @@ # __decay_and_strip is used internally in the C++11 standard library. # IWYU does not classify it as internal and suggests to add <type_traits>. # To ignore it, we simply map it to a file that is included anyway. - # Use '-Xiwyu -v7' to see the fully qualified names that need this. + # Use 'CMake_IWYU_VERBOSE' to see the fully qualified names that need this. # TODO: Can this be simplified with an @-expression? #{ symbol: [ "@std::__decay_and_strip<.*>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<bool>::__type", private, "\"cmConfigure.h\"", public ] }, |