diff options
-rw-r--r-- | cmake/check_compiler_flag.cmake | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cmake/check_compiler_flag.cmake b/cmake/check_compiler_flag.cmake index ef675959059..673361ab8fe 100644 --- a/cmake/check_compiler_flag.cmake +++ b/cmake/check_compiler_flag.cmake @@ -32,25 +32,25 @@ MACRO (MY_CHECK_CXX_COMPILER_FLAG flag) SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}") ENDMACRO() -FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag) +FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag_to_set) # At the moment this is gcc-only. # Let's avoid expensive compiler tests on Windows: IF(WIN32) RETURN() ENDIF() - MY_CHECK_C_COMPILER_FLAG(${flag}) - MY_CHECK_CXX_COMPILER_FLAG(${flag}) - STRING(REGEX REPLACE "[-,= +]" "_" result "${flag}") + STRING(REGEX REPLACE "^-Wno-" "-W" flag_to_check ${flag_to_set}) + MY_CHECK_C_COMPILER_FLAG(${flag_to_check}) + MY_CHECK_CXX_COMPILER_FLAG(${flag_to_check}) + STRING(REGEX REPLACE "[-,= +]" "_" result "${flag_to_check}") FOREACH(lang C CXX) IF (HAVE_${lang}_${result}) IF(ARGN) FOREACH(type ${ARGN}) - SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag}" PARENT_SCOPE) + SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag_to_set}" PARENT_SCOPE) ENDFOREACH() ELSE() - SET(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} ${flag}" PARENT_SCOPE) + SET(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} ${flag_to_set}" PARENT_SCOPE) ENDIF() ENDIF() ENDFOREACH() ENDFUNCTION() - |