From 3e4df86ac02b21f206e64c17beea69285bc332a5 Mon Sep 17 00:00:00 2001 From: Trond H Emaus Date: Sat, 28 Mar 2020 10:26:32 +0100 Subject: [PATCH] create MSVC_OPTIONS list only if compiler is msvc --- cmake/utils.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index bd6d3777..5581ef95 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -28,10 +28,13 @@ endfunction() # Turn on warnings on the given target function(spdlog_enable_warnings target_name) - list(APPEND MSVC_OPTIONS "/W3") - if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015 - list(APPEND MSVC_OPTIONS "/WX") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + list(APPEND MSVC_OPTIONS "/W3") + if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015 + list(APPEND MSVC_OPTIONS "/WX") + endif() endif() + target_compile_options(${target_name} PRIVATE $<$,$,$>: -Wall -Wextra -Wconversion -pedantic -Wfatal-errors>