-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectOptions.cmake
More file actions
77 lines (64 loc) · 1.99 KB
/
Copy pathProjectOptions.cmake
File metadata and controls
77 lines (64 loc) · 1.99 KB
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
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
macro(stomp_setup_options)
if(NOT PROJECT_IS_TOP_LEVEL)
option(STOMP_WARNINGS_AS_ERRORS "Treat Warnings As Errors" OFF)
option(STOMP_ENABLE_UNITY_BUILD "Enable unity builds" OFF)
option(STOMP_ENABLE_PCH "Enable precompiled headers" OFF)
option(STOMP_ENABLE_CACHE "Enable ccache" OFF)
option(STOMP_ENABLE_TESTS "Enable tests" ON)
else()
option(STOMP_WARNINGS_AS_ERRORS "Treat Warnings As Errors" ON)
option(STOMP_ENABLE_UNITY_BUILD "Enable unity builds" OFF)
option(STOMP_ENABLE_PCH "Enable precompiled headers" OFF)
option(STOMP_ENABLE_CACHE "Enable ccache" OFF)
option(STOMP_ENABLE_TESTS "Enable tests" ON)
endif()
if(NOT PROJECT_IS_TOP_LEVEL)
mark_as_advanced(
STOMP_WARNINGS_AS_ERRORS
STOMP_ENABLE_UNITY_BUILD
STOMP_ENABLE_COVERAGE
STOMP_ENABLE_PCH
STOMP_ENABLE_CACHE)
endif()
endmacro()
macro(stomp_local_options)
if(PROJECT_IS_TOP_LEVEL)
include(CMake/StandardProjectSettings.cmake)
endif()
add_library(stomp_warnings INTERFACE)
add_library(stomp_options INTERFACE)
include(CMake/CompilerWarnings.cmake)
stomp_set_project_warnings(
stomp_warnings
${STOMP_WARNINGS_AS_ERRORS}
""
""
""
"")
set_target_properties(stomp_options PROPERTIES UNITY_BUILD ${STOMP_ENABLE_UNITY_BUILD})
if(STOMP_ENABLE_PCH)
target_precompile_headers(
STOMP_options
INTERFACE
<vector>
<string>
<utility>)
endif()
if(STOMP_ENABLE_CACHE)
include(CMake/Cache.cmake)
stomp_enable_cache()
endif()
if(STOMP_ENABLE_COVERAGE)
include(cmake/Tests.cmake)
stomp_enable_coverage(stomp_options)
endif()
if(STOMP_WARNINGS_AS_ERRORS)
check_cxx_compiler_flag("-Wl,--fatal-warnings" LINKER_FATAL_WARNINGS)
if(LINKER_FATAL_WARNINGS)
# This is not working consistently, so disabling for now
# target_link_options(STOMP_options INTERFACE -Wl,--fatal-warnings)
endif()
endif()
endmacro()