开发者

Conditional CMAKE link to rt-library

How to write CMakeLists.txt to conditionally link to the system-wide librt librar开发者_运维知识库y only when on Linux environment?


cmake has several predefined variables useful for environment detection (WIN32, UNIX, APPLE, CYGWIN). Here is the full list: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#section_VariablesThatDescribetheSystem

So you can write something like

if(UNIX AND NOT APPLE)
    target_link_libraries(target_name rt)
endif()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜