Commit f6692b7b authored by Tom Finegan's avatar Tom Finegan

Add flag for disabling compiler tests to the CMake build.

Speeds up CMake (re)generation when working on changes to
the build.

Change-Id: I0b7eee2e32686d7e8672a87db83078462f3560ba
parent e784b3f2
......@@ -23,6 +23,10 @@ set(AOM_FAILED_CXX_FLAGS)
# the compile test passes. Caches $c_flag in $AOM_FAILED_C_FLAGS when the test
# fails.
function (add_c_flag_if_supported c_flag)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(C_FLAG_FOUND CACHE)
string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
unset(C_FLAG_FAILED CACHE)
......@@ -45,6 +49,10 @@ endfunction ()
# $CMAKE_CXX_FLAGS when the compile test passes. Caches $c_flag in
# $AOM_FAILED_CXX_FLAGS when the test fails.
function (add_cxx_flag_if_supported cxx_flag)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(CXX_FLAG_FOUND CACHE)
string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
unset(CXX_FLAG_FAILED CACHE)
......@@ -74,6 +82,10 @@ endfunction ()
# Checks C compiler for support of $c_flag and terminates generation when
# support is not present.
function (require_c_flag c_flag update_c_flags)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(C_FLAG_FOUND CACHE)
string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
......@@ -94,6 +106,10 @@ endfunction ()
# Checks CXX compiler for support of $cxx_flag and terminates generation when
# support is not present.
function (require_cxx_flag cxx_flag update_cxx_flags)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(CXX_FLAG_FOUND CACHE)
string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
......@@ -244,6 +260,10 @@ endfunction ()
# Adds $flag to executable linker flags, and makes sure C/CXX builds still work.
function (require_linker_flag flag)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
append_exe_linker_flag(${flag})
unset(c_passed)
......
......@@ -40,6 +40,10 @@ endfunction ()
# The test is not run if the test name is found in either of the passed or
# failed test variables.
function(aom_check_c_compiles test_name test_source result_var)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(C_TEST_PASSED CACHE)
unset(C_TEST_FAILED CACHE)
string(FIND "${AOM_C_PASSED_TESTS}" "${test_name}" C_TEST_PASSED)
......@@ -71,6 +75,10 @@ endfunction ()
# The test is not run if the test name is found in either of the passed or
# failed test variables.
function(aom_check_cxx_compiles test_name test_source result_var)
if (DEBUG_CMAKE_DISABLE_COMPILER_TESTS)
return()
endif ()
unset(CXX_TEST_PASSED CACHE)
unset(CXX_TEST_FAILED CACHE)
string(FIND "${AOM_CXX_PASSED_TESTS}" "${test_name}" CXX_TEST_PASSED)
......
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