generated from CoolLibs/library-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
46 lines (39 loc) · 1.33 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
cmake_minimum_required(VERSION 3.20)
set(WARNINGS_AS_ERRORS_FOR_SERV OFF CACHE BOOL "ON iff you want to treat warnings as errors")
add_library(serv)
add_library(serv::serv ALIAS serv)
target_compile_features(serv PRIVATE cxx_std_17)
# Set warning level
if(MSVC)
target_compile_options(serv PRIVATE /W4)
else()
target_compile_options(serv PRIVATE -Wall -Wextra -Wpedantic -pedantic-errors -Wconversion -Wno-unknown-pragmas)
endif()
# Maybe enable warnings as errors
if(WARNINGS_AS_ERRORS_FOR_SERV)
if(MSVC)
target_compile_options(serv PRIVATE /WX)
else()
target_compile_options(serv PRIVATE -Werror)
endif()
endif()
# ---Add source files---
if(WARNINGS_AS_ERRORS_FOR_SERV)
target_include_directories(serv PUBLIC include)
else()
target_include_directories(serv SYSTEM PUBLIC include)
endif()
target_sources(serv PRIVATE
src/serv.cpp
)
# ---CivetWeb---
add_library(civetweb)
target_include_directories(civetweb SYSTEM PUBLIC lib/civetweb/include)
target_sources(civetweb PRIVATE
lib/civetweb/src/civetweb.c
lib/civetweb/src/CivetServer.cpp
)
target_compile_definitions(civetweb PRIVATE NO_SSL)
target_compile_options(civetweb PRIVATE -w)
target_link_libraries(serv PUBLIC civetweb)
install(FILES "lib/civetweb/LICENSE.md" DESTINATION "license/civetweb")