CMake:有没有强制链接库? [英] CMake: Is there anyway to force linking libraries?
问题描述
还是有强制链接库。这在一些库已更改但当前项目的任何源代码没有更改时将很有用。我正在寻找这样的东西:
make link
主要的想法是给一个完整的路径target_link_libraries(),而不只是库名。
如果你想显式地触发重新链接自己,你可以使用add_custom_command以创建 make link
的命令,这将删除可执行文件,然后触发常规 make
重建它。 p>
Is there anyway to force linking libraries again. This would be useful when some libraries have changed but there is no change in any of the source codes of current project. I am looking for something like this:
make link
CMake should be able to relink automatically when a particular library changes if you follow the tips here: http://www.cmake.org/pipermail/cmake/2010-November/041072.html
The main idea is to give a full path to target_link_libraries(), rather than just the library name. If you give a full path, CMake will actually inspect the file for modification and relink if it has changed.
If you prefer to explicitly trigger relinking yourself, you can use add_custom_command to make a command like make link
which will remove the executable and then trigger a regular make
to rebuild it.
这篇关于CMake:有没有强制链接库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!