-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
51 lines (43 loc) · 1.58 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
# ---Choose CMake version---
cmake_minimum_required(VERSION 3.20)
# ---Choose project name---
project(Simple-p6-Setup)
# ---Declare source files---
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS src/*)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE src)
# ---Choose C++ version---
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
# ---Choose warning level---
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -pedantic-errors -Wimplicit-fallthrough)
endif()
# ---Maybe enable warnings as errors---
set(WARNINGS_AS_ERRORS OFF CACHE BOOL "ON iff you want to treat warnings as errors")
if(WARNINGS_AS_ERRORS)
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Werror)
endif()
endif()
# ---Setup Testing---
include(FetchContent)
FetchContent_Declare(
doctest
GIT_REPOSITORY https://github.com/doctest/doctest
GIT_TAG ae7a13539fb71f270b87eb2e874fbac80bc8dda2
)
FetchContent_MakeAvailable(doctest)
target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest)
# ---Add p6 library---
# set(P6_RAW_OPENGL_MODE ON CACHE BOOL "") # You need to press F1 and use "CMake: Delete Cache and Reconfigure" when enabling this option.
FetchContent_Declare(
p6
GIT_REPOSITORY https://github.com/julesfouchy/p6
GIT_TAG c962f8c5f3bf8324482facaf2ec178ef4c9aefaa
)
FetchContent_MakeAvailable(p6)
target_link_libraries(${PROJECT_NAME} PRIVATE p6::p6)