summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-04-11 22:56:50 +0200
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-04-13 16:04:10 +0200
commitd2b0a47c6fc4f3f4c9c869111c0750f6d5a9d574 (patch)
treeae316b7e3717c517093d18f162b1cd8569f4df61 /CMakeLists.txt
parente155fba644d4686ac8b4f43dfe31c749bba30c67 (diff)
downloadcmake-d2b0a47c6fc4f3f4c9c869111c0750f6d5a9d574.tar.gz
Add include-what-you-use mapping
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
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"