Commit 2a7fc9e3 authored by Trond H Emaus's avatar Trond H Emaus

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
parent f1b4f15d
...@@ -28,13 +28,15 @@ endfunction() ...@@ -28,13 +28,15 @@ endfunction()
# Turn on warnings on the given target # Turn on warnings on the given target
function(spdlog_enable_warnings target_name) 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 target_compile_options(${target_name} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wconversion -pedantic -Wfatal-errors> -Wall -Wextra -Wconversion -pedantic -Wfatal-errors>
$<$<CXX_COMPILER_ID:MSVC>:/W3>) $<$<CXX_COMPILER_ID:MSVC>:${MSVC_OPTIONS}>)
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
target_compile_options(${target_name} PRIVATE /WX)
endif()
endfunction() endfunction()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment