summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-05-25 16:43:26 (GMT)
committerBrad King <brad.king@kitware.com>2018-05-25 16:46:19 (GMT)
commit281f59536f8c16f9eacf175f8316a82f09629203 (patch)
treeeaa2684ec17acca79e1b46a69b409c962a4e830f
parente6a32f0525d936990ee6df5441d510fa6255f696 (diff)
downloadCMake-281f59536f8c16f9eacf175f8316a82f09629203.zip
CMake-281f59536f8c16f9eacf175f8316a82f09629203.tar.gz
CMake-281f59536f8c16f9eacf175f8316a82f09629203.tar.bz2
IWYU: Define a macro to tell code it is preprocessing for iwyu
There are some cases where satisfying IWYU breaks compilation, such as forward-declaring the `std::hash<>` template with C++ standard libraries that use an inline namespace inside `std`. Define a macro during include-what-you-use preprocessing so that code can adapt.
-rw-r--r--CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ee67cb..e20d770 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,7 +285,7 @@ if(CMake_RUN_IWYU)
message(FATAL_ERROR "CMake_RUN_IWYU is ON but include-what-you-use is not found!")
endif()
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
- "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w")
+ "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w;-DCMAKE_IWYU")
endif()