compile_flag: add failure regex
This commit is contained in:
parent
26319b51a1
commit
87cfe7d051
@ -1,4 +1,5 @@
|
|||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
|
include(CMakeCheckCompilerFlagCommonPatterns)
|
||||||
|
|
||||||
# Test if a compiler flag is supported.
|
# Test if a compiler flag is supported.
|
||||||
#
|
#
|
||||||
@ -11,6 +12,12 @@ include(CheckCXXSourceCompiles)
|
|||||||
macro (append_compile_flag _flag)
|
macro (append_compile_flag _flag)
|
||||||
string (MAKE_C_IDENTIFIER ${_flag} _name)
|
string (MAKE_C_IDENTIFIER ${_flag} _name)
|
||||||
|
|
||||||
|
CHECK_COMPILER_FLAG_COMMON_PATTERNS(_append_compile_flag_COMMON_PATTERNS)
|
||||||
|
set(_append_compile_flag_COMMON_PATTERNS
|
||||||
|
${_append_compile_flag_COMMON_PATTERNS}
|
||||||
|
FAIL_REGEX "argument unused during compilation" #clang
|
||||||
|
)
|
||||||
|
|
||||||
if (NOT DEFINED compile_flag_${_name})
|
if (NOT DEFINED compile_flag_${_name})
|
||||||
# If we have an argument of the form "-Wno-foo" then we can't test it
|
# If we have an argument of the form "-Wno-foo" then we can't test it
|
||||||
# directly as GCC will unconditioally succeed right up until the
|
# directly as GCC will unconditioally succeed right up until the
|
||||||
@ -30,7 +37,12 @@ macro (append_compile_flag _flag)
|
|||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -W${_inverse_flag}")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -W${_inverse_flag}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
check_cxx_source_compiles("int main(int,char**) { return 0; }" compile_flag_${_name})
|
check_cxx_source_compiles(
|
||||||
|
"int main(int,char**) { return 0; }"
|
||||||
|
compile_flag_${_name}
|
||||||
|
${_append_compile_flag_COMMON_PATTERNS}
|
||||||
|
)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${_append_compile_flag_REQUIRED_FLAGS}")
|
set(CMAKE_REQUIRED_FLAGS "${_append_compile_flag_REQUIRED_FLAGS}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user