-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
49 lines (40 loc) · 1.18 KB
/
Copy pathCMakeLists.txt
File metadata and controls
49 lines (40 loc) · 1.18 KB
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
cmake_minimum_required(VERSION 3.14)
project(testcoe_basic_example LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Find testcoe package or fetch it from GitHub
find_package(testcoe QUIET)
if(NOT testcoe_FOUND)
include(FetchContent)
FetchContent_Declare(
testcoe
GIT_REPOSITORY https://github.com/nircoe/testcoe.git
GIT_TAG v0.1.0
)
set(TESTCOE_BUILD_EXAMPLES ON CACHE BOOL "Disable testcoe examples" FORCE)
set(TESTCOE_BUILD_TESTS ON CACHE BOOL "Disable testcoe tests" FORCE)
FetchContent_MakeAvailable(testcoe)
endif()
endif()
# Note: You don't need to find or fetch GTest separately
# because testcoe already includes and links against it.
# Add the executable
add_executable(basic_example
main.cpp
math_tests.cpp
string_tests.cpp
vector_tests.cpp
)
copy_mingw_dlls_to_target(basic_example)
# Link against testcoe
target_link_libraries(basic_example
PRIVATE
testcoe
)
# Add an easy way to run the example
add_custom_target(run_basic_example
COMMAND basic_example
DEPENDS basic_example
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)