@@ -18,13 +18,18 @@ HunterGate(
18
18
19
19
project (jaegertracing VERSION 0.5.0)
20
20
21
+ option (JAEGERTRACING_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF )
22
+
21
23
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
22
24
CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
23
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -pedantic" )
25
+ set (cxx_flags -Wall -pedantic)
26
+ if (JAEGERTRACING_WARNINGS_AS_ERRORS)
27
+ list (APPEND cxx_flags -Werror)
28
+ endif ()
24
29
endif ()
25
30
26
31
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
27
- set ( CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-unused-private-field" )
32
+ list ( APPEND cxx_flags -Wno-unused-private -field)
28
33
endif ()
29
34
30
35
set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
@@ -91,7 +96,8 @@ if(BUILD_TESTING)
91
96
92
97
if (JAEGERTRACING_COVERAGE)
93
98
include (CodeCoverage)
94
- append_coverage_compiler_flags()
99
+ append_coverage_compiler_flags(cxx_flags )
100
+ append_coverage_compiler_flags(link_flags )
95
101
set (COVERAGE_EXCLUDES "${CMAKE_CURRENT_SOURCE_DIR} /src/jaegertracing/thrift-gen/*"
96
102
"*Test.cpp" )
97
103
endif ()
@@ -200,7 +206,8 @@ function(add_lib_deps lib)
200
206
target_include_directories (${lib} PUBLIC
201
207
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /src>
202
208
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /src>)
203
- target_link_libraries (${lib} PUBLIC ${LIBS} )
209
+ target_link_libraries (${lib} PUBLIC ${link_flags} ${LIBS} )
210
+ target_compile_options (${lib} PUBLIC ${cxx_flags} )
204
211
endfunction ()
205
212
206
213
option (JAEGERTRACING_PLUGIN "Build dynamic plugin" OFF )
0 commit comments