mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
add /WX mscv compiler option for only mscv compiler
clang on windows support both gcc and mscv style options. Clang.exe on windows defaults to gcc style, which will result in /WX unknown compiler command. This will set /WX if and only if the compiler is MSVC and greater than version 1900
This commit is contained in:
parent
f1b4f15dbb
commit
2a7fc9e30e
@ -28,13 +28,15 @@ endfunction()
|
||||
|
||||
# Turn on warnings on the given target
|
||||
function(spdlog_enable_warnings target_name)
|
||||
set(MSVC_OPTIONS "/W3")
|
||||
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
|
||||
set(MSVC_OPTIONS "${MSVC_OPTIONS} /WX")
|
||||
endif()
|
||||
target_compile_options(${target_name} PRIVATE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
|
||||
-Wall -Wextra -Wconversion -pedantic -Wfatal-errors>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/W3>)
|
||||
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
|
||||
target_compile_options(${target_name} PRIVATE /WX)
|
||||
endif()
|
||||
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_OPTIONS}>)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user