0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00
openvpn3/test/unittests/CMakeLists.txt

76 lines
1.9 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.5)
project(tests)
set(CMAKE_CXX_STANDARD 14)
include(findcoredeps)
include(dlgoogletest)
# Extra includes/libraries that are currently only use by the core unit test
FIND_PATH(LZO_INCLUDE_DIR NAMES lzo/lzo1x.h)
FIND_LIBRARY(LZO_LIBRARIES NAMES lzo2)
if (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
list(APPEND CORE_TEST_DEFINES -DHAVE_LZO)
list(APPEND EXTRA_LIBS ${LZO_LIBRARIES})
list(APPEND EXTRA_INCLUDES ${LZO_INCLUDE_DIR})
message("lzo found, running lzo compression tests")
else ()
message("lzo not found, skipping lzo compression tests")
endif ()
set(CORE_TEST_DEFINES
-DOPENVPN_FORCE_TUN_NULL
-DUNIT_TEST
-DUNITTEST_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"
)
add_executable(coreUnitTests
core_tests.cpp
test_route_emulation.cpp
test_log.cpp
test_comp.cpp
test_b64.cpp
test_verify_x509_name.cpp
test_ssl.cpp
test_continuation.cpp
test_optfilt.cpp
test_remotelist.cpp
)
if (${USE_MBEDTLS})
target_sources(coreUnitTests PRIVATE
test_mbedtls_x509certinfo.cpp
)
else ()
target_sources(coreUnitTests PRIVATE
test_openssl_x509certinfo.cpp
)
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_sources(coreUnitTests PRIVATE test_sitnl.cpp)
endif ()
if (UNIX)
target_sources(coreUnitTests PRIVATE test_cpu_time.cpp)
endif ()
if (WIN32)
target_sources(coreUnitTests PRIVATE test_iphelper.cpp)
endif ()
if (WIN32)
target_sources(coreUnitTests PRIVATE test_iphelper.cpp)
endif ()
add_core_dependencies(coreUnitTests)
target_link_libraries(coreUnitTests ${GTEST_LIB} ${EXTRA_LIBS})
target_compile_definitions(coreUnitTests PRIVATE ${CORE_TEST_DEFINES})
target_include_directories(coreUnitTests PRIVATE ${EXTRA_INCLUDES})
add_test(NAME CoreTests COMMAND coreUnitTests)