aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-01-14 15:37:31 +0100
committerGitHub <noreply@github.com>2023-01-14 15:37:31 +0100
commitc1fffc42fbf32f5faac07de8fb7aab7943d1cc53 (patch)
tree88e40feb5cfcf22135d83f828632dc33873402bf
parent686168c648e46986088f677028c2b245f6b78303 (diff)
downloadrneovim-c1fffc42fbf32f5faac07de8fb7aab7943d1cc53.tar.gz
rneovim-c1fffc42fbf32f5faac07de8fb7aab7943d1cc53.tar.bz2
rneovim-c1fffc42fbf32f5faac07de8fb7aab7943d1cc53.zip
build: enable iwyu with target properties instead of variables (#21797)
IWYU stopped working after 438b4361cc761a2950689668f008cfe06c1510f7, likely due to the code being moved from CMakeLists.txt to src/nvim/CMakelists.txt. Using the IWYU target property instead of the variable ensures that the information to use IWYU isn't lost.
-rwxr-xr-xsrc/nvim/CMakeLists.txt15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index a479ae4d1c..b95709526b 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -77,12 +77,15 @@ if(ENABLE_IWYU)
if(NOT IWYU_PRG)
message(FATAL_ERROR "ENABLE_IWYU is ON but include-what-you-use is not found!")
endif()
- set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_PRG}
- -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/mapping.imp
- -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.libc.imp
- -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.symbols.imp
- -Xiwyu --no_default_mappings)
- target_compile_definitions(main_lib INTERFACE EXITFREE)
+
+ set(iwyu_flags "${IWYU_PRG};")
+ string(APPEND iwyu_flags "-Xiwyu;--no_default_mappings;")
+ string(APPEND iwyu_flags "-Xiwyu;--mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/mapping.imp;")
+ string(APPEND iwyu_flags "-Xiwyu;--mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.libc.imp;")
+ string(APPEND iwyu_flags "-Xiwyu;--mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.symbols.imp")
+
+ set_target_properties(nvim PROPERTIES C_INCLUDE_WHAT_YOU_USE "${iwyu_flags}")
+ target_compile_definitions(nvim PRIVATE EXITFREE)
endif()
if(MSVC)