mirror of
https://github.com/dropbox/json11.git
synced 2024-11-27 07:59:50 +08:00
Protect against literal interpretation (#137)
* Protect against literal interpretation On msvc 2017 this seems to have been checking for existence of a flag called `_warning_flag` * Stop checking for flag called "IN" * Ensure compiler flag checks are not cached Per the docs of CMake the call to CHECK_CXX_COMPILER_FLAG stores the result in an internal cache entry. In this loop we were basically skipping the "supported" check for all flags after the first one. Forcibly unsetting the variable before each check ensures that we actually check if each specific flag is supported
This commit is contained in:
parent
4b30939ac9
commit
402bcde713
@ -30,8 +30,9 @@ target_compile_options(json11
|
||||
# Set warning flags, which may vary per platform
|
||||
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)
|
||||
foreach(_warning_flag ${_possible_warnings_flags})
|
||||
unset(_flag_supported)
|
||||
CHECK_CXX_COMPILER_FLAG(${_warning_flag} _flag_supported)
|
||||
if(${_flag_supported})
|
||||
target_compile_options(json11 PRIVATE ${_warning_flag})
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user