Skip to content

Commit

Permalink
refactor(tests): Make the unit tests compile on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfr committed Oct 14, 2024
1 parent 0da4ed5 commit 97e0bf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") # Reduce warnings level
else()
add_compile_options(-Wno-unused-variable -Wno-unused-function)
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments) # silence warning for the check library
endif()

# Load CMake Packages
# Check dependency
find_package(Check REQUIRED)
set(LIBS ${CHECK_LIBRARIES} ${open62541_LIBRARIES})
if(NOT WIN32 AND NOT APPLE AND NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD"))
if(NOT WIN32 AND NOT APPLE AND NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") AND NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "FreeBSD"))
list(APPEND LIBS subunit)
endif()
include_directories(${CHECK_INCLUDE_DIRS})
link_directories(${CHECK_LIBRARY_DIRS})

include_directories(${CHECK_INCLUDE_DIR})
#find_package(Threads REQUIRED)
# Valgrind dependency
if(NOT MSVC AND UA_ENABLE_UNIT_TESTS_MEMCHECK)
find_package(Valgrind REQUIRED)
endif()
Expand Down
9 changes: 5 additions & 4 deletions tools/cmake/FindCheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ endif()
IF( NOT CHECK_FOUND )
IF ( CHECK_INSTALL_DIR )
MESSAGE ( STATUS "Using override CHECK_INSTALL_DIR to find check" )
SET ( CHECK_INCLUDE_DIR "${CHECK_INSTALL_DIR}/include" )
FIND_LIBRARY( CHECK_LIBRARIES NAMES check PATHS "${CHECK_INSTALL_DIR}/lib" )
SET ( CHECK_INCLUDE_DIRS "${CHECK_INSTALL_DIR}/include" )
SET ( CHECK_LIBRARY_DIRS "${CHECK_INSTALL_DIR}/lib" )
FIND_LIBRARY( CHECK_LIBRARIES NAMES check PATHS ${CHECK_LIBRARY_DIRS} )
ELSE ( CHECK_INSTALL_DIR )
FIND_PATH( CHECK_INCLUDE_DIR check.h )
FIND_PATH( CHECK_INCLUDE_DIRS check.h )
FIND_LIBRARY( CHECK_LIBRARIES NAMES check )
ENDIF ( CHECK_INSTALL_DIR )

Expand All @@ -56,4 +57,4 @@ IF( NOT CHECK_FOUND )
ENDIF( NOT CHECK_FOUND )

# Hide advanced variables from CMake GUIs
MARK_AS_ADVANCED( CHECK_INCLUDE_DIR CHECK_LIBRARIES )
MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARY_DIRS CHECK_LIBRARIES )

0 comments on commit 97e0bf3

Please sign in to comment.