From cbdd89493fc65c29ef2efd2d13b0fd82a6db1984 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 24 Dec 2011 11:34:35 +0100 Subject: [PATCH] properly add librt when clock_gettime is used --- src/Main/CMakeLists.txt | 4 ++++ utils/GPSsmooth/CMakeLists.txt | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 6a4df8c89..f96ca1e07 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -85,7 +85,11 @@ target_link_libraries(fgfs install(TARGETS fgfs RUNTIME DESTINATION bin) +check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) add_executable(metar metar_main.cxx) +if(HAVE_CLOCK_GETTIME) + target_link_libraries(metar rt) +endif(HAVE_CLOCK_GETTIME) target_link_libraries(metar ${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} diff --git a/utils/GPSsmooth/CMakeLists.txt b/utils/GPSsmooth/CMakeLists.txt index 47bc1d54f..8844bb341 100644 --- a/utils/GPSsmooth/CMakeLists.txt +++ b/utils/GPSsmooth/CMakeLists.txt @@ -1,4 +1,6 @@ +check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) + add_executable(GPSsmooth gps.cxx gps.hxx gps_main.cxx) add_executable(MIDGsmooth MIDG-II.cxx MIDG-II.hxx MIDG_main.cxx) add_executable(UGsmooth @@ -8,6 +10,10 @@ add_executable(UGsmooth UGear_telnet.cxx UGear_telnet.hxx) +if(HAVE_CLOCK_GETTIME) + target_link_libraries(GPSsmooth rt) +endif(HAVE_CLOCK_GETTIME) + target_link_libraries(GPSsmooth ${SIMGEAR_CORE_LIBRARIES} ${PLIB_SG_LIBRARY} @@ -17,6 +23,10 @@ target_link_libraries(GPSsmooth ${WINMM_LIBRARY} ) +if(HAVE_CLOCK_GETTIME) + target_link_libraries(MIDGsmooth rt) +endif(HAVE_CLOCK_GETTIME) + target_link_libraries(MIDGsmooth ${SIMGEAR_CORE_LIBRARIES} ${PLIB_SG_LIBRARY} @@ -26,6 +36,10 @@ target_link_libraries(MIDGsmooth ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ) +if(HAVE_CLOCK_GETTIME) + target_link_libraries(UGsmooth rt) +endif(HAVE_CLOCK_GETTIME) + target_link_libraries(UGsmooth ${SIMGEAR_CORE_LIBRARIES} ${PLIB_SG_LIBRARY} -- 2.39.5