-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
77 lines (57 loc) · 1.51 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0135 NEW)
project (t LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Library
set(LIBRARY_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
set(LIBRARY_SOURCES
${LIBRARY_SOURCE_DIR}/null.cpp
)
add_library(t STATIC ${LIBRARY_SOURCES})
target_include_directories(
t
PUBLIC
${CMAKE_SOURCE_DIR}/include/
)
install(
TARGETS t
RUNTIME
LIBRARY
)
# Executable
add_executable(cube src/cube.cpp)
target_link_libraries(cube PUBLIC t)
add_executable(cornell_box src/cornell_box.cpp)
target_link_libraries(cornell_box PUBLIC t)
add_executable(teapot src/teapot.cpp)
target_link_libraries(teapot PUBLIC t)
add_executable(teapot2 src/teapot2.cpp)
target_link_libraries(teapot2 PUBLIC t)
add_executable(triangle src/triangle.cpp)
target_link_libraries(triangle PUBLIC t)
# GoogleTest
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.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_executable(
t_test
tests/main.cpp
)
target_link_libraries(
t_test
t
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(t_test)