-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (44 loc) · 981 Bytes
/
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
cmake_minimum_required(VERSION 3.1.0)
project(utils VERSION 1.0.0 LANGUAGES CXX)
# include(FetchContent)
# FetchContent_Declare(
# googletest
# URL https://github.com/google/googletest/archive/58d77fa8070e8cec2dc1ed015d66b454c8d78850.zip
# )
# # For Windows: Prevent overriding the parent project's compiler/linker settings
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# FetchContent_MakeAvailable(googletest)
find_package(GTest REQUIRED)
add_library(
utils
src/utils.cc
)
target_include_directories(
utils PRIVATE
src/include
)
add_executable(
main
src/main.cc
)
target_link_libraries(
main
utils
)
# google test
enable_testing()
add_executable(
test_utils
tests/test_utils.cc
)
target_compile_definitions(
test_utils PUBLIC
RESOURCES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources"
)
target_link_libraries(
test_utils
GTest::gtest_main
utils
)
include(GoogleTest)
gtest_discover_tests(test_utils)