我主要按照PC-Lint needs a list of all include paths for the files to be scanned. How to get a list of all include paths recursively needed by a target in CMake?尝试将PC-Lint Plus合并到我的cmake项目中。
PC-Lint正在被调用,但由于并非所有包含都在PC-Lint调用中而最终死亡。
我将上面的链接转储到Lint.cmake中,并将其包含在我的顶层cmake中。在我的项目文件中,我添加了
if(COMMAND add_pc_lint)
add_pc_lint(moded ${SRC_FILES})
endif(COMMAND add_pc_lint)
所以我希望行数>
function(add_pc_lint target) get_directory_property(lint_include_directories INCLUDE_DIRECTORIES) # let's get those elephants across the alps # prepend each include directory with "-i"; also quotes the directory set(lint_include_directories_transformed) foreach(include_dir ${lint_include_directories}) list(APPEND lint_include_directories_transformed -i"${include_dir}") endforeach(include_dir)
将包含目录列表从INCLUDE_DIRECTORIES中拉出。
如果添加
message(STATUS "********************************************") message(STATUS "Include directories - ${lint_include_directories}") message(STATUS "********************************************") message(STATUS "********************************************") message(STATUS "INCLUDE_DIRECTORIES - ${INCLUDE_DIRECTORIES}") message(STATUS "********************************************")
直接在foreach循环的上方,lint_include_directories和INCLUDE_DIRECTORIES似乎都为空。
我需要做些什么来获取包含目录的完整列表,包括从target_link_libraries和target_include_directories,从cmake传递给PC-Lint Plus?
我正在尝试将PC-Lint Plus合并到我的cmake项目中,主要是每个PC-Lint都需要列出要扫描文件的所有包含路径。如何递归获取所有包含路径的列表...
PC-Lint使用上的documentation似乎是为旧的CMake而不是基于目标的现代CMake的。 add_pc_lint
函数从CMake目录属性中获取包含目录