在CMake中为每个目标设置CXX_INCLUDE_WHAT_YOU_USE属性

时间:2017-01-12 10:31:08

标签: cmake

我的项目中有多个CmakeLists.txt,我想启用<h1> Production Hourly Report</h1> <table id='completions'> <caption>Production Orders Completion Per Hour</caption> <thead> <tr> <th>Production Hour</th><th>FFS</th><th>SHF</th><th>SF</th><th>Scrap</th> </tr> </thead> <tbody> </tbody> </table>

添加

iwyu

将为一个目标启用它。我想为每个目标启用它以避免在另一个文件中出现冗余。我将其包含在已经存在的CMakeLists.txt中。

1 个答案:

答案 0 :(得分:4)

cmake_minimum_required(VERSION 3.3 FATAL_ERROR)

find_program(IWYU_PATH NAMES include-what-you-use iwyu)
if(NOT IWYU_PATH)
  message(FATAL_ERROR "Could not find the program include-what-you-use")
endif()
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})

&#34;文档&#34;可在此处找到:CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE