Commit 58447949 authored by Tom Finegan's avatar Tom Finegan Committed by James Zern

Fix CMake build configurations using linker flag dependent compiler flags.

The CMake compiler test functions are built atop CMake's try_compile()
function. try_compile() ignores configuration specific link flags in
favor of the generic linker flag variable (CMAKE_EXE_LINKER_FLAGS is
used instead of CMAKE_EXE_LINKER_FLAGS_<CONFIG>). This patch applies
the flags cached in AOM_EXE_LINKER_FLAGS to CMAKE_EXE_LINKER_FLAGS
during C and C++ compiler tests.

Change-Id: I831244d114a8195527bcb865537494a98cabc170
parent 9f02130a
......@@ -122,6 +122,10 @@ function (require_c_flag c_flag update_c_flags)
return ()
endif ()
if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
aom_push_var(CMAKE_EXE_LINKER_FLAGS "${AOM_EXE_LINKER_FLAGS}")
endif ()
unset(HAVE_C_FLAG CACHE)
message("Checking C compiler flag support for: " ${c_flag})
check_c_compiler_flag("${c_flag}" HAVE_C_FLAG)
......@@ -130,6 +134,10 @@ function (require_c_flag c_flag update_c_flags)
"${PROJECT_NAME} requires support for C flag: ${c_flag}.")
endif ()
if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
aom_pop_var(CMAKE_EXE_LINKER_FLAGS)
endif ()
append_flag(AOM_C_FLAGS "${c_flag}")
if (update_c_flags)
foreach (config ${AOM_C_CONFIGS})
......@@ -150,6 +158,10 @@ function (require_cxx_flag cxx_flag update_cxx_flags)
return ()
endif ()
if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
aom_push_var(CMAKE_EXE_LINKER_FLAGS "${AOM_EXE_LINKER_FLAGS}")
endif ()
unset(HAVE_CXX_FLAG CACHE)
message("Checking C compiler flag support for: " ${cxx_flag})
check_cxx_compiler_flag("${cxx_flag}" HAVE_CXX_FLAG)
......@@ -158,6 +170,10 @@ function (require_cxx_flag cxx_flag update_cxx_flags)
"${PROJECT_NAME} requires support for C flag: ${cxx_flag}.")
endif ()
if (NOT "${AOM_EXE_LINKER_FLAGS}" STREQUAL "")
aom_pop_var(CMAKE_EXE_LINKER_FLAGS)
endif ()
append_flag(AOM_CXX_FLAGS "${cxx_flag}")
if (update_cxx_flags)
foreach (config ${AOM_CXX_CONFIGS})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment