diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 997bc2d1..6b6bfa5f 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -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 $<$,$,$>: -Wall -Wextra -Wconversion -pedantic -Wfatal-errors> - $<$:/W3>) - if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015 - target_compile_options(${target_name} PRIVATE /WX) - endif() + $<$:${MSVC_OPTIONS}>) + endfunction()