-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (36 loc) · 1013 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
cmake_minimum_required(VERSION 3.25)
project(result)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_custom_command(
OUTPUT result.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND python3 -m venv venv
COMMAND . ./venv/bin/activate
COMMAND pip3 install quom
COMMAND quom src/result-wrapper.h result.h
COMMENT "Merging source files into single header"
VERBATIM
)
add_custom_target(
result_header ALL
DEPENDS result.h
)
file(GLOB_RECURSE TESTS_SOURCES "tests/*.cpp")
add_executable(
tests
${TESTS_SOURCES}
)
add_dependencies(tests result_header)
target_link_libraries(tests GTest::gtest_main)
include(GoogleTest)
gtest_discover_tests(tests)