cmake: treat warnings as error in compiler flag tests
This commit is contained in:
parent
db564efe0b
commit
2e9af2a1c8
|
@ -71,16 +71,18 @@ function (die msg)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
function (add_c_flag_if_supported flag var)
|
function (add_c_flag_if_supported flag var)
|
||||||
string(REPLACE "-" "_" supported ${flag}_c)
|
set(TMP "-Werror ${flag}")
|
||||||
check_c_compiler_flag(${flag} ${supported})
|
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c)
|
||||||
|
check_c_compiler_flag(${TMP} ${supported})
|
||||||
if(${${supported}})
|
if(${${supported}})
|
||||||
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function (add_cxx_flag_if_supported flag var)
|
function (add_cxx_flag_if_supported flag var)
|
||||||
string(REPLACE "-" "_" supported ${flag}_cxx)
|
set(TMP "-Werror ${flag}")
|
||||||
check_cxx_compiler_flag(${flag} ${supported})
|
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx)
|
||||||
|
check_cxx_compiler_flag(${TMP} ${supported})
|
||||||
if(${${supported}})
|
if(${${supported}})
|
||||||
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue