mirror of
https://github.com/dropbox/json11.git
synced 2024-11-27 07:59:50 +08:00
Refactored warning flag checks to use CheckCXXCompilerFlag
module since Windows can compile without MSVC
This commit is contained in:
parent
3d69faa498
commit
067fd4934b
@ -18,13 +18,14 @@ target_compile_options(json11
|
||||
PRIVATE -fPIC -fno-rtti -fno-exceptions -Wall)
|
||||
|
||||
# Set warning flags, which may vary per platform
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(json11
|
||||
PRIVATE /W4 /WX)
|
||||
else()
|
||||
target_compile_options(json11
|
||||
PRIVATE -Wextra -Werror)
|
||||
endif()
|
||||
include(CheckCXXCompilerFlag)
|
||||
set(_possible_warnings_flags /W4 /WX -Wextra -Werror)
|
||||
foreach(_warning_flag in ${_possible_warnings_flags})
|
||||
CHECK_CXX_COMPILER_FLAG(_warning_flag _flag_supported)
|
||||
if(${_flag_supported})
|
||||
target_compile_options(json11 PRIVATE ${_warning_flag})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_file("json11.pc.in" "json11.pc" @ONLY)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user