forked from Autodesk/Aurora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (48 loc) · 1.76 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Specify the library (for dependents), project (IDE), and output (binary file) names.
project(FoundationTests)
# List of common helper files shared by all tests. TEST_HELPERS_FOLDER variable is set in parent cmake file.
set(HELPER_FILES
"${TEST_HELPERS_FOLDER}/TestHelpers.cpp"
"${TEST_HELPERS_FOLDER}/TestHelpers.h")
# List of actual test files.
set(TEST_FILES
"Tests/TestLogger.cpp"
"Tests/TestMath.cpp"
"Tests/TestUtilities.cpp")
# Add test executable with all source files.
add_executable(${PROJECT_NAME}
${HELPER_FILES}
${TEST_FILES}
"FoundationMain.cpp"
)
# Put test files and helpers in seperate folders.
source_group("Helpers" FILES ${HELPER_FILES})
source_group("Tests" FILES ${TEST_FILES})
# Set custom output properties.
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "Tests"
RUNTIME_OUTPUT_DIRECTORY "${RUNTIME_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_DIR}"
ARCHIVE_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_DIR}"
PDB_OUTPUT_DIRECTORY "${RUNTIME_OUTPUT_DIR}"
VS_DEBUGGER_WORKING_DIRECTORY "${RUNTIME_OUTPUT_DIR}"
VS_DEBUGGER_ENVIRONMENT "${VS_DEBUGGING_ENV}"
XCODE_SCHEME_ENVIRONMENT "${XCODE_DEBUGGING_ENV}")
# Add dependencies.
target_link_libraries(${PROJECT_NAME}
PRIVATE
glm::glm
GTest::gtest
GTest::gmock
${CMAKE_DL_LIBS}
Foundation
)
# Add helpers include folder.
target_include_directories(${PROJECT_NAME} PRIVATE ${TEST_HELPERS_FOLDER})
# Add default compile definitions (set in root CMakefile)
target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFAULT_COMPILE_DEFINITIONS})
# Run gtest discover tests function.
gtest_discover_tests(${PROJECT_NAME}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${RUNTIME_OUTPUT_DIR}"
)