[CMake] Add -lrt at the end of link.txt

Rolf Eike Beer eike at sf-mail.de
Tue Jan 7 10:18:47 EST 2014


Am 07.01.2014 12:56, schrieb Cedric Doucet:
> He llo,
> 
> I would like to know how to add "-lrt" at the end of link.txt.
> I tried to do that by modifying CMakeLists.txt.
> I added the following lines:
> ----------------------------------------------------------------------------------------------------------------
> list(APPEND CMAKE_CXX_FLAGS "-lrt")
> list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS)
> string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
> ----------------------------------------------------------------------------------------------------------------
> However, it does not work.
> 
> Anybody have an idea?

target_link_libraries(my_target_that_needs_rt rt)

HTH,

Eike


More information about the CMake mailing list