When testing compiler flags, test them with previously-tested flags.

That mirrors what we're doing with autotools, and catches cases where
an earlier-tested flag affects the results for a later-tested flag
(e.g., -fwrapv can affect whether -fno-strict-overflow produces a
warning when tested).

Change-Id: I8ca0b6f5dee14d2394af9b6b8b93b9dbda2702d7
Reviewed-on: https://code.wireshark.org/review/3369
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-08-02 15:43:36 -07:00
parent 81f5d71ff3
commit e2969cbb3c
1 changed files with 2 additions and 2 deletions

View File

@ -349,7 +349,7 @@ foreach(THIS_FLAG ${C_FLAG_TESTS})
set(${F} ${THIS_FLAG})
set(V C_${F}_VALID)
message(STATUS "Checking for c-compiler flag: ${THIS_FLAG}")
check_c_compiler_flag(${${F}} ${V})
check_c_compiler_flag("${ADDED_CMAKE_C_FLAGS} ${${F}}" ${V})
if (${${V}})
set(ADDED_CMAKE_C_FLAGS "${ADDED_CMAKE_C_FLAGS} ${${F}}")
endif()
@ -361,7 +361,7 @@ foreach(THIS_FLAG ${CPP_FLAG_TESTS})
set(${F} ${THIS_FLAG})
set(V CPP_${F}_VALID)
message(STATUS "Checking for c++-compiler flag: ${THIS_FLAG}")
check_cxx_compiler_flag(${${F}} ${V})
check_cxx_compiler_flag("${ADDED_CMAKE_CXX_FLAGS} ${${F}}" ${V})
if (${${V}})
set(ADDED_CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${${F}}")
endif()