Add ApiTest.cpp
This commit is contained in:
@@ -87,12 +87,12 @@ add_custom_command(
|
||||
COMMAND_EXPAND_LISTS)
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
|
||||
set_target_properties(
|
||||
${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
||||
"${CMAKE_BINARY_DIR}/versioned-map")
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
|
||||
endif()
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
if(HAS_VERSION_SCRIPT)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
@@ -100,9 +100,9 @@ if(HAS_VERSION_SCRIPT)
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME}-static STATIC ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.o)
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set_target_properties(${PROJECT_NAME}-static PROPERTIES LINKER_LANGUAGE C)
|
||||
endif()
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}-static PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
|
||||
set_target_properties(${PROJECT_NAME}-static PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
if(NOT APPLE)
|
||||
add_custom_command(
|
||||
@@ -115,6 +115,8 @@ if(NOT APPLE)
|
||||
"Proceeding with all symbols global in static library")
|
||||
endif()
|
||||
|
||||
set(TEST_FLAGS -Wall -Wextra -Wunreachable-code -Wpedantic -UNDEBUG)
|
||||
|
||||
include(CTest)
|
||||
|
||||
option(BUILD_TREE_VIS "Build tree visualization" OFF)
|
||||
@@ -130,16 +132,24 @@ if(BUILD_TESTING)
|
||||
add_executable(rootset_test RootSet.cpp)
|
||||
target_compile_definitions(rootset_test PRIVATE ENABLE_ROOTSET_TESTS)
|
||||
target_compile_options(rootset_test PRIVATE -fsanitize=address,undefined
|
||||
-UNDEBUG)
|
||||
${TEST_FLAGS})
|
||||
target_link_options(rootset_test PRIVATE -fsanitize=address,undefined)
|
||||
add_test(NAME rootset_test COMMAND rootset_test)
|
||||
|
||||
add_executable(rootset_test_tsan RootSet.cpp)
|
||||
target_compile_definitions(rootset_test_tsan PRIVATE ENABLE_ROOTSET_TESTS)
|
||||
target_compile_options(rootset_test_tsan PRIVATE -fsanitize=thread -UNDEBUG)
|
||||
target_compile_options(rootset_test_tsan PRIVATE -fsanitize=thread
|
||||
${TEST_FLAGS})
|
||||
target_link_options(rootset_test_tsan PRIVATE -fsanitize=thread)
|
||||
add_test(NAME rootset_test_tsan COMMAND rootset_test)
|
||||
|
||||
add_executable(api_test ApiTest.cpp)
|
||||
target_link_libraries(api_test PRIVATE ${PROJECT_NAME})
|
||||
target_compile_options(api_test PRIVATE -fsanitize=address,undefined
|
||||
${TEST_FLAGS})
|
||||
target_link_options(api_test PRIVATE -fsanitize=address,undefined)
|
||||
add_test(NAME api_test COMMAND api_test)
|
||||
|
||||
# symbol visibility tests
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
if(APPLE)
|
||||
|
Reference in New Issue
Block a user