summaryrefslogtreecommitdiffstats
path: root/third_party/aom/build/cmake/compiler_tests.cmake
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
committertrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
commitec910d81405c736a4490383a250299a7837c2e64 (patch)
tree4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/build/cmake/compiler_tests.cmake
parent01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff)
downloadUXP-ec910d81405c736a4490383a250299a7837c2e64.tar
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz
UXP-ec910d81405c736a4490383a250299a7837c2e64.zip
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/build/cmake/compiler_tests.cmake')
-rw-r--r--third_party/aom/build/cmake/compiler_tests.cmake46
1 files changed, 41 insertions, 5 deletions
diff --git a/third_party/aom/build/cmake/compiler_tests.cmake b/third_party/aom/build/cmake/compiler_tests.cmake
index 89f0bc12c..8a73ec8ff 100644
--- a/third_party/aom/build/cmake/compiler_tests.cmake
+++ b/third_party/aom/build/cmake/compiler_tests.cmake
@@ -14,6 +14,34 @@ set(AOM_BUILD_CMAKE_COMPILER_TESTS_CMAKE_ 1)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
+# CMake passes command line flags like this:
+# $compiler $lang_flags $lang_flags_config ...
+# To ensure the flags tested here and elsewhere are obeyed a list of active
+# build configuration types is built, and flags are applied to the flag strings
+# for each configuration currently active for C and CXX builds as determined by
+# reading $CMAKE_CONFIGURATION_TYPES and $CMAKE_BUILD_TYPE. When
+# $CMAKE_CONFIGURATION_TYPES is non-empty a multi-configuration generator is in
+# use: currently this includes MSVC and Xcode. For other generators
+# $CMAKE_BUILD_TYPE is used. For both cases AOM_<LANG>_CONFIGS is populated with
+# CMake string variable names that contain flags for the currently available
+# configuration(s).
+unset(AOM_C_CONFIGS)
+unset(AOM_CXX_CONFIGS)
+list(LENGTH CMAKE_CONFIGURATION_TYPES num_configs)
+if (${num_configs} GREATER 0)
+ foreach (config ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER ${config} config)
+ list(APPEND AOM_C_CONFIGS "CMAKE_C_FLAGS_${config}")
+ list(APPEND AOM_CXX_CONFIGS "CMAKE_CXX_FLAGS_${config}")
+ list(APPEND AOM_EXE_LINKER_CONFIGS "CMAKE_EXE_LINKER_FLAGS_${config}")
+ endforeach ()
+else ()
+ string(TOUPPER ${CMAKE_BUILD_TYPE} config)
+ set(AOM_C_CONFIGS "CMAKE_C_FLAGS_${config}")
+ set(AOM_CXX_CONFIGS "CMAKE_CXX_FLAGS_${config}")
+ set(AOM_EXE_LINKER_CONFIGS "CMAKE_EXE_LINKER_FLAGS_${config}")
+endif ()
+
# The basic main() function used in all compile tests.
set(AOM_C_MAIN "\nint main(void) { return 0; }")
set(AOM_CXX_MAIN "\nint main() { return 0; }")
@@ -25,8 +53,8 @@ set(AOM_CXX_PASSED_TESTS)
set(AOM_CXX_FAILED_TESTS)
function(aom_push_var var new_value)
- set(SAVED_${var} ${var} PARENT_SCOPE)
- set(${var} ${new_value} PARENT_SCOPE)
+ set(SAVED_${var} ${${var}} PARENT_SCOPE)
+ set(${var} "${${var}} ${new_value}" PARENT_SCOPE)
endfunction ()
function(aom_pop_var var)
@@ -40,6 +68,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 +103,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)
@@ -100,9 +136,9 @@ endfunction ()
# Convenience function that confirms $test_source compiles as C and C++.
# $result_var is set to 1 when both tests are successful, and 0 when one or both
# tests fail.
-# Note: This function is intended to be used to write to result variables that are
-# expanded via configure_file(). $result_var is set to 1 or 0 to allow direct
-# usage of the value in generated source files.
+# Note: This function is intended to be used to write to result variables that
+# are expanded via configure_file(). $result_var is set to 1 or 0 to allow
+# direct usage of the value in generated source files.
function(aom_check_source_compiles test_name test_source result_var)
unset(C_PASSED)
unset(CXX_PASSED)