commit 8fce0c027f3b21269fe14df0d6d6b552aba7e173
parent df2794969496e9ab55e67c67359eaff2beae8d1e
Author: kinichiro <[email protected]>
Date: Wed, 1 Jul 2020 17:43:56 +0900
Check if OS has librt, and do not link it if not exist
Diffstat:
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -60,6 +60,8 @@ check_cxx_compiler_flag("-msse2" SUPPORT_SSE)
check_cxx_compiler_flag("-mfpu=neon -Werror" SUPPORT_NEON)
check_include_file_cxx(complex HAVE_CPP_STD_COMPLEX)
+find_library(HAVE_LIBRT rt)
+
set(CMAKE_REQUIRED_FLAGS "")
@@ -559,7 +561,9 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
elseif(APPLE)
set(PTHREAD_LIBRARY pthread)
else()
- set(PLATFORM_LIBRARIES rt)
+ if(HAVE_LIBRT)
+ set(PLATFORM_LIBRARIES rt)
+ endif()
set(PTHREAD_LIBRARY pthread)
endif()
diff --git a/src/Plugin/ZynAddSubFX/CMakeLists.txt b/src/Plugin/ZynAddSubFX/CMakeLists.txt
@@ -118,12 +118,22 @@ elseif(ZestGui)
if(APPLE)
set(PLATFORM_LIBRARIES)
else()
- set(PLATFORM_LIBRARIES X11 GL rt)
+ if(HAVE_LIBRT)
+ set(PLATFORM_LIBRARIES X11 GL rt)
+ else()
+ set(PLATFORM_LIBRARIES X11 GL)
+ endif()
endif()
elseif(NtkGui OR FltkGui)
- set(PLATFORM_LIBRARIES X11 rt)
+ if(HAVE_LIBRT)
+ set(PLATFORM_LIBRARIES X11 rt)
+ else()
+ set(PLATFORM_LIBRARIES X11)
+ endif()
else()
- set(PLATFORM_LIBRARIES rt)
+ if(HAVE_LIBRT)
+ set(PLATFORM_LIBRARIES rt)
+ endif()
endif()
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")