-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
35 lines (26 loc) · 873 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
cmake_minimum_required(VERSION 3.14)
project(cppc_lib)
set(CMAKE_CXX_STANDARD 11)
# GTEST
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
file(GLOB SOURCES "src/*.cpp")
include_directories("include/")
link_libraries("pthread")
# OPTION: main
add_executable("main" "dev/main.cpp" ${SOURCES})
# OPTION: lib
add_library("cppc_lib" ${SOURCES})
# OPTION: tests
enable_testing()
file(GLOB_RECURSE TESTFILES ${PROJECT_SOURCE_DIR}/tests/*_test.cpp)
add_executable(run_tests ${TESTFILES} ${SOURCES})
target_link_libraries(run_tests gtest_main)
include(GoogleTest)
gtest_discover_tests(run_tests)