瀏覽代碼

adapt compiler settings for OpenBSD

Julius Pfrommer 7 年之前
父節點
當前提交
0d61353cbc
共有 2 個文件被更改,包括 8 次插入4 次删除
  1. 3 3
      CMakeLists.txt
  2. 5 1
      tests/CMakeLists.txt

+ 3 - 3
CMakeLists.txt

@@ -111,7 +111,7 @@ mark_as_advanced(UA_COMPILE_AS_CXX)
 list(APPEND open62541_LIBRARIES "")
 if(NOT WIN32)
   list(APPEND open62541_LIBRARIES pthread)
-  if (NOT APPLE)
+  if(NOT APPLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
     list(APPEND open62541_LIBRARIES rt)
   endif()
 else()
@@ -126,8 +126,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
     add_definitions(-std=c99 -pipe -Wall -Wextra -Werror -Wformat -Wno-unused-parameter
                     -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wreturn-type -Wsign-compare
                     -Wmultichar -Wstrict-overflow -Wcast-qual -Wmissing-prototypes -Wstrict-prototypes
-                    -Winit-self -Wuninitialized -Wformat-security -Wformat-nonliteral)
-    if(NOT WIN32 AND NOT CYGWIN)
+                    -Winit-self -Wformat-security -Wformat-nonliteral)
+    if(NOT WIN32 AND NOT CYGWIN AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
         add_definitions(-Wshadow -Wconversion -fvisibility=hidden -fPIC)
     endif()
 

+ 5 - 1
tests/CMakeLists.txt

@@ -14,6 +14,10 @@ endif()
 
 set(LIBS ${CHECK_LIBRARIES} ${open62541_LIBRARIES})
 
+if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+  link_directories("/usr/local/lib")
+endif()
+
 # Build the plugins used for testing
 set(test_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_network_tcp.c
                         ${PROJECT_SOURCE_DIR}/tests/testing_clock.c
@@ -25,7 +29,7 @@ add_library(open62541-testplugins OBJECT ${test_plugin_sources})
 add_dependencies(open62541-testplugins open62541)
 
 # Workaround some clang warnings in the uni tests
-if(CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
+if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
     add_definitions(-Wno-sign-conversion)
 endif()