generated from CoolLibs/library-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
42 lines (34 loc) · 1.28 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
cmake_minimum_required(VERSION 3.20)
set(WARNINGS_AS_ERRORS_FOR_GLPP OFF CACHE BOOL "ON iff you want to treat warnings as errors")
add_library(glpp)
add_library(glpp::glpp ALIAS glpp)
target_compile_features(glpp PUBLIC cxx_std_20)
# Set warning level
if(MSVC)
target_compile_options(glpp PRIVATE /W4)
else()
target_compile_options(glpp PRIVATE -Wall -Wextra -Wpedantic -pedantic-errors -Wconversion -Wsign-conversion)
endif()
# Maybe enable warnings as errors
if(WARNINGS_AS_ERRORS_FOR_GLPP)
if(MSVC)
target_compile_options(glpp PRIVATE /WX)
else()
target_compile_options(glpp PRIVATE -Werror)
endif()
endif()
# ---Add glad---
add_library(glad third-party/glad/src/gl.c)
target_include_directories(glad SYSTEM PUBLIC third-party/glad/include)
target_link_libraries(glpp PUBLIC glad)
install(FILES "third-party/glad/include/KHR/khrplatform.h" DESTINATION "license/KHR")
# ---Add source files---
if(WARNINGS_AS_ERRORS_FOR_GLPP)
set(MAYBE_SYSTEM "")
else()
set(MAYBE_SYSTEM "SYSTEM")
endif()
target_include_directories(glpp ${MAYBE_SYSTEM} INTERFACE include)
target_include_directories(glpp ${MAYBE_SYSTEM} PUBLIC src)
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS src/*.cpp)
target_sources(glpp PRIVATE ${SRC_FILES})