diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-04-11 22:56:50 +0200 |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-04-13 16:04:10 +0200 |
commit | d2b0a47c6fc4f3f4c9c869111c0750f6d5a9d574 (patch) | |
tree | ae316b7e3717c517093d18f162b1cd8569f4df61 /CMakeLists.txt | |
parent | e155fba644d4686ac8b4f43dfe31c749bba30c67 (diff) | |
download | cmake-d2b0a47c6fc4f3f4c9c869111c0750f6d5a9d574.tar.gz |
Add include-what-you-use mapping
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ed5de10efd..545177b6e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,17 @@ option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON) mark_as_advanced(CMAKE_USE_FOLDERS) +option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF) +if(CMake_RUN_IWYU) + find_program(IWYU_COMMAND NAMES include-what-you-use iwyu) + if(NOT IWYU_COMMAND) + 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") +endif() + + #----------------------------------------------------------------------- # a macro that only sets the FOLDER target property if it's # "appropriate" |