Library linking fix for OpenBSD

Issue #75 closed
Brad Smith created an issue

Here is a fix for a library linking issue with OpenBSD; OpenBSD does not have a librt library.

I am not all that familiar with CMake but I believe this is the proper syntax.

--- source/CMakeLists.txt.orig  Thu Aug 21 17:49:02 2014
+++ source/CMakeLists.txt       Sun Aug 31 10:30:23 2014
@@ -55,9 +55,9 @@ endif()

 if(UNIX)
     SET(PLATFORM_LIBS pthread)
-    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
         SET(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
-    endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
 endif(UNIX)

 # Compiler detection

Comments (3)

  1. Steve Borho

    Hmm, this would probably not fix FreeBSD or any similar BSD O/S. I don't see any simple way in CMake to detect "BSD-like" so I'm thinking the best option here is to actually check for the librt existance. I'm pushing a fix for this to stable, please verify.

  2. Log in to comment