diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 23:05:00 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 23:05:03 -0500 |
commit | d2499ead93dc4298c0882fe98902acb1b5209f99 (patch) | |
tree | cb0b942aed59e5108f9a3e9d64e7b77854383421 /third_party/aom/build/cmake/util.cmake | |
parent | 41fbdea457bf50c0a43e1c27c5cbf7f0a3a9eb33 (diff) | |
download | UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.gz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.lz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.xz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.zip |
Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591
Diffstat (limited to 'third_party/aom/build/cmake/util.cmake')
-rw-r--r-- | third_party/aom/build/cmake/util.cmake | 91 |
1 files changed, 87 insertions, 4 deletions
diff --git a/third_party/aom/build/cmake/util.cmake b/third_party/aom/build/cmake/util.cmake index a0c705691..b70ec4013 100644 --- a/third_party/aom/build/cmake/util.cmake +++ b/third_party/aom/build/cmake/util.cmake @@ -13,19 +13,21 @@ if(AOM_BUILD_CMAKE_UTIL_CMAKE_) endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_ set(AOM_BUILD_CMAKE_UTIL_CMAKE_ 1) +# Directory where generated sources will be written. +set(AOM_GEN_SRC_DIR "${AOM_CONFIG_DIR}/gen_src") + # Creates dummy source file in $AOM_CONFIG_DIR named $basename.$extension and # returns the full path to the dummy source file via the $out_file_path # parameter. -function(create_dummy_source_file basename extension out_file_path) - set(dummy_source_file "${AOM_CONFIG_DIR}/${basename}_dummy.${extension}") +macro(create_dummy_source_file basename extension out_file_path) + set(dummy_source_file "${AOM_GEN_SRC_DIR}/${basename}_dummy.${extension}") file( WRITE "${dummy_source_file}" "// Generated file. DO NOT EDIT!\n" "// ${target_name} needs a ${extension} file to force link language, \n" "// or to silence a harmless CMake warning: Ignore me.\n" "void ${target_name}_dummy_function(void) {}\n") - set(${out_file_path} ${dummy_source_file} PARENT_SCOPE) -endfunction() +endmacro() # Convenience function for adding a dummy source file to $target_name using # $extension as the file extension. Wraps create_dummy_source_file(). @@ -86,3 +88,84 @@ function(set_compiler_launcher launcher_flag launcher_name) endif() endfunction() +# Sentinel value used to detect when a variable has been set via the -D argument +# passed to CMake on the command line. +set(cmake_cmdline_helpstring "No help, variable specified on the command line.") + +# Wrapper macro for set() that does some book keeping to help with storage of +# build configuration information. +# +# Sets the default value for variable $name when the value of $name has not +# already been set via the CMake command line. +# +# The names of variables defaulted through this macro are added to +# $AOM_CONFIG_VARS to facilitate build logging and diagnostics. +macro(set_aom_detect_var name value type helpstring) + unset(list_index) + list(FIND AOM_DETECT_VARS ${name} list_index) + if(${list_index} EQUAL -1) + list(APPEND AOM_DETECT_VARS ${name}) + endif() + + # Update the variable only when it does not carry the CMake assigned help + # string for variables specified via the command line. + unset(cache_helpstring) + get_property(cache_helpstring CACHE ${name} PROPERTY HELPSTRING) + if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") + set(${name} ${value} CACHE ${type} "${helpstring}") + mark_as_advanced(${name}) + else() + message( + WARNING + "${name} has been set by CMake, but it may be overridden by the build " + "system during environment detection") + endif() +endmacro() + +# Wrapper macro for set() that does some book keeping to help with storage of +# build configuration information. +# +# Sets the default value for variable $name when the value of $name has not +# already been set via the CMake command line. +# +# The names of variables defaulted through this macro are added to +# $AOM_CONFIG_VARS to facilitate build logging and diagnostics. +macro(set_aom_config_var name value type helpstring) + unset(list_index) + list(FIND AOM_CONFIG_VARS ${name} list_index) + if(${list_index} EQUAL -1) + list(APPEND AOM_CONFIG_VARS ${name}) + endif() + + # Update the variable only when it does not carry the CMake assigned help + # string for variables specified via the command line. + unset(cache_helpstring) + get_property(cache_helpstring CACHE ${name} PROPERTY HELPSTRING) + if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") + set(${name} ${value} CACHE ${type} "${helpstring}") + endif() +endmacro() + +# Wrapper macro for option() that does some book keeping to help with storage of +# build configuration information. +# +# Sets the default value for variable $name when the value of $name has not +# already been set via the CMake command line. +# +# The names of variables defaulted through this macro are added to +# $AOM_OPTION_VARS to facilitate build logging and diagnostics. +macro(set_aom_option_var name helpstring value) + unset(list_index) + list(FIND AOM_OPTION_VARS ${name} list_index) + if(${list_index} EQUAL -1) + list(APPEND AOM_OPTION_VARS ${name}) + endif() + + # Update the variable only when it does not carry the CMake assigned help + # string for variables specified via the command line. + unset(cache_helpstring) + get_property(cache_helpstring CACHE ${name} PROPERTY HELPSTRING) + if(NOT "${cache_helpstring}" STREQUAL "${cmake_cmdline_helpstring}") + option(${name} "${helpstring}" ${value}) + endif() +endmacro() |