aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66f4d0363..362ca8d56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,16 +71,18 @@ function (die msg)
endfunction ()
function (add_c_flag_if_supported flag var)
- string(REPLACE "-" "_" supported ${flag}_c)
- check_c_compiler_flag(${flag} ${supported})
+ set(TMP "-Werror ${flag}")
+ string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c)
+ check_c_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_cxx_flag_if_supported flag var)
- string(REPLACE "-" "_" supported ${flag}_cxx)
- check_cxx_compiler_flag(${flag} ${supported})
+ set(TMP "-Werror ${flag}")
+ string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx)
+ check_cxx_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()