CMake自定义目标的依赖关系图

前端之家收集整理的这篇文章主要介绍了CMake自定义目标的依赖关系图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
CMake的–graphviz选项是否应该依赖于自定义目标?

示例CMakeLists.txt文件

cmake_minimum_required(VERSION 2.8)
add_executable(target0 test.cpp)
add_dependencies(target0 target1)
add_custom_target(target1 ALL
  COMMAND echo hello
)

输出文件“cmake –graphviz = test.dot.”将会:

digraph GG {
node [
  fontsize = "12"
];
    "node3" [ label="target0" shape="house"];
}

没有任何目标1的痕迹.

解决方法

CMake manual明确指出:

–graphviz=[file]

Generate a graphviz input file that will contain all the library and executable dependencies in the project. See the documentation for CMakeGraphVizOptions.cmake for more details.

因此,据我所知,您的自定义目标既不是 – 也不是库,也不是可执行文件可以包含在结果图中.

猜你在找的设计模式相关文章