generated from CoolLibs/library-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
36 lines (30 loc) · 1.1 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
cmake_minimum_required(VERSION 3.8)
set(WARNINGS_AS_ERRORS_FOR_STRINGIFY OFF CACHE BOOL "ON iff you want to treat warnings as errors")
add_library(stringify src/stringify.cpp)
add_library(stringify::stringify ALIAS stringify)
target_compile_features(stringify PUBLIC cxx_std_20)
if(WARNINGS_AS_ERRORS_FOR_STRINGIFY)
target_include_directories(stringify PUBLIC include)
else()
target_include_directories(stringify SYSTEM PUBLIC include)
endif()
# fmt
set(FMT_SYSTEM_HEADERS ON CACHE BOOL "" FORCE)
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory(lib/fmt)
target_link_libraries(stringify PUBLIC fmt::fmt)
install(FILES "lib/fmt/LICENSE" DESTINATION "license/fmt")
# Set warning level
if(MSVC)
target_compile_options(stringify PRIVATE /W4)
else()
target_compile_options(stringify PRIVATE -Wall -Wextra -Wpedantic -pedantic-errors -Wconversion -Wsign-conversion)
endif()
# Maybe enable warnings as errors
if(WARNINGS_AS_ERRORS_FOR_STRINGIFY)
if(MSVC)
target_compile_options(stringify PRIVATE /WX)
else()
target_compile_options(stringify PRIVATE -Werror)
endif()
endif()