如何在CMake文件中引用安装目标?
例如,我想做类似
的事情add_custom_target(my-target DEPENDS install COMMAND my-target-command)
如果我打电话
cmake --build . --target help
来自CMAKE_CURRENT_BINARY_DIR,在返回的列表中,我可以看到目标安装。
尝试
make my-target
将“Unix Makefiles”作为生成器导致错误
make[2]: *** No rule to make target `CMakeFiles/install.dir/all', needed by `CMakeFiles/my-target.dir/all'. Stop.