From d2b0a47c6fc4f3f4c9c869111c0750f6d5a9d574 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Tue, 11 Apr 2017 22:56:50 +0200 Subject: Add include-what-you-use mapping --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'CMakeLists.txt') 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" -- cgit v1.2.1