我的项目中有多个CmakeLists.txt,我想启用iwyu
。
新增中
set_property( TARGETS MY-TARGET PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path} )
将使它成为一个目标。我想为每个目标启用它,以避免在另一个文件中产生冗余。我在已经存在的CMakeLists.txt中添加了该文件。
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})
可以在这里找到“文档”:CMAKE_