]> git.cworth.org Git - vogl/blobdiff - src/voglcore/CMakeLists.txt
cmake: Use find_package to find pthreads
[vogl] / src / voglcore / CMakeLists.txt
index 9dd0f5067048bb910df5bde3445f931b89520f44..476cb3a241e2e3aa19d2ff5c6d44016685640742 100644 (file)
@@ -2,6 +2,10 @@ project(voglcore)
 cmake_minimum_required(VERSION 2.8)
 
 option(VOGL_ENABLE_ASSERTS "Enable assertions in all builds (including release)" FALSE)
+find_package(Threads)
+if (NOT CMAKE_USE_PTHREADS_INIT)
+    message(ERROR "pthread not found")
+endif ()
 
 include("${SRC_DIR}/build_options.cmake")
 
@@ -105,7 +109,10 @@ else()
 endif()
 
 add_library(${PROJECT_NAME} ${SRC_LIST})
-target_link_libraries(${PROJECT_NAME} rt)
+target_link_libraries(${PROJECT_NAME}
+    ${CMAKE_THREAD_LIBS_INIT}
+    rt
+    )
 
 build_options_finalize()