Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,42 @@ if (WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) # cmake-lint: disable=C0103
endif ()

set(TEST_PATTERNS test_* mock_*)
file(GLOB_RECURSE TEST_SOURCES
${CMAKE_SOURCE_DIR}/tests/conftest.cpp
${CMAKE_SOURCE_DIR}/tests/utils.cpp
${CMAKE_SOURCE_DIR}/tests/test_*.cpp)
"${CMAKE_SOURCE_DIR}/tests/conftest.cpp"
"${CMAKE_SOURCE_DIR}/tests/utils.cpp")
set(TEST_PLATFORM_SOURCES)

foreach(pattern ${TEST_PATTERNS})
file(GLOB_RECURSE CURRENT_TEST_SOURCES
"${CMAKE_SOURCE_DIR}/tests/${pattern}.cpp")
list(APPEND TEST_SOURCES ${CURRENT_TEST_SOURCES})

if(WIN32)
file(GLOB_RECURSE CURRENT_TEST_PLATFORM_SOURCES
"${CMAKE_SOURCE_DIR}/tests/*/platf/windows/${pattern}.cpp")
elseif(__APPLE__)
file(GLOB_RECURSE CURRENT_TEST_PLATFORM_SOURCES
"${CMAKE_SOURCE_DIR}/tests/*/platf/macos/${pattern}.cpp")
elseif(UNIX)
file(GLOB_RECURSE CURRENT_TEST_PLATFORM_SOURCES
"${CMAKE_SOURCE_DIR}/tests/*/platf/linux/${pattern}.cpp")
else()
message(FATAL_ERROR "Unsupported platform")
endif()

list(APPEND TEST_PLATFORM_SOURCES ${CURRENT_TEST_PLATFORM_SOURCES})
endforeach()

list(FILTER TEST_SOURCES EXCLUDE REGEX ".*/platf/.*")
message(STATUS "Common Test sources: ${TEST_SOURCES}")

set(DD_SOURCES
${DD_TARGET_FILES})

add_executable(${PROJECT_NAME}
${TEST_SOURCES}
${TEST_PLATFORM_SOURCES}
${DD_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
target_link_libraries(${PROJECT_NAME}
Expand Down
1 change: 1 addition & 0 deletions tests/unit/platf/linux/test_linux_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: remove this file
1 change: 1 addition & 0 deletions tests/unit/platf/macos/test_macos_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: remove this file
1 change: 1 addition & 0 deletions tests/unit/platf/windows/test_windows_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: remove this file