CMAKE-从命令行附加cmake_cxx_flags
我想从命令行添加一些cmake_cxx_flags
cmakelists.txt中定义的标志,例如:
cmake -DCMAKE_CXX_FLAGS="-Wall" ..
它仅在cmakelists.txt中的标志附加到列表中时才能工作。
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
在下种情况下:
set(CMAKE_CXX_FLAGS "-Wall")
cmake_cxx_flags
从命令行传递会被覆盖。
是否有任何方法可以防止命令行中定义的覆盖标志,而无需modyfing cmakelists.txt?
I would like to add some CMAKE_CXX_FLAGS
from the command line to the flags defined in CMakeLists.txt, for example:
cmake -DCMAKE_CXX_FLAGS="-Wall" ..
It will work only when flags are appended to the list in the CMakeLists.txt, for example:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
In the following case:
set(CMAKE_CXX_FLAGS "-Wall")
CMAKE_CXX_FLAGS
passed from the command line wil be overwritten.
Is there any way to prevent overwritting flags defined in the command line without modyfing CMakeLists.txt ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论