Build: clear old linux centos7 cache variables instead of printing them
More automatic and convenient to update existing configurations this way. Also move into platform_old_libs_update.cmake where similar logic was put already.
This commit is contained in:
parent
bd2d7a4a81
commit
65d8da97b8
|
@ -2009,24 +2009,6 @@ if(0)
|
|||
print_all_vars()
|
||||
endif()
|
||||
|
||||
set(LIBDIR_STALE)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# Only search for the path if it's found on the system.
|
||||
if(EXISTS "../lib/linux_centos7_x86_64")
|
||||
set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBDIR_STALE)
|
||||
print_cached_vars_containing_value(
|
||||
"${LIBDIR_STALE}"
|
||||
"\nWARNING: found cached references to old library paths!\n"
|
||||
"\nIt is *strongly* recommended to reference updated library paths!\n"
|
||||
)
|
||||
endif()
|
||||
unset(LIBDIR_STALE)
|
||||
|
||||
# Should be the last step of configuration.
|
||||
if(POSTCONFIGURE_SCRIPT)
|
||||
include(${POSTCONFIGURE_SCRIPT})
|
||||
|
|
|
@ -1209,43 +1209,6 @@ function(print_all_vars)
|
|||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Print a list of all cached variables with values containing `contents`.
|
||||
function(print_cached_vars_containing_value
|
||||
contents
|
||||
msg_header
|
||||
msg_footer
|
||||
)
|
||||
set(_list_info)
|
||||
set(_found)
|
||||
get_cmake_property(_vars VARIABLES)
|
||||
foreach(_var ${_vars})
|
||||
if(DEFINED CACHE{${_var}})
|
||||
# Skip "_" prefixed variables, these are used for internal book-keeping,
|
||||
# not under user control.
|
||||
string(FIND "${_var}" "_" _found)
|
||||
if(NOT (_found EQUAL 0))
|
||||
string(FIND "${${_var}}" "${contents}" _found)
|
||||
if(NOT (_found EQUAL -1))
|
||||
if(_found)
|
||||
list(APPEND _list_info "${_var}=${${_var}}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_var)
|
||||
unset(_vars)
|
||||
unset(_found)
|
||||
if(_list_info)
|
||||
message(${msg_header})
|
||||
foreach(_var ${_list_info})
|
||||
message(" * ${_var}")
|
||||
endforeach()
|
||||
message(${msg_footer})
|
||||
endif()
|
||||
unset(_list_info)
|
||||
endfunction()
|
||||
|
||||
macro(openmp_delayload
|
||||
projectname
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
# Auto update existing CMake caches for new libraries
|
||||
|
||||
# Clear cached variables whose name matches `pattern`.
|
||||
function(unset_cache_variables pattern)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
|
@ -12,6 +13,30 @@ function(unset_cache_variables pattern)
|
|||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Clear cached variables with values containing `contents`.
|
||||
function(unset_cached_varables_containting contents msg)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
set(_found)
|
||||
set(_print_msg)
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
# Skip "_" prefixed variables, these are used for internal book-keeping,
|
||||
# not under user control.
|
||||
string(FIND "${_cache_variable}" "_" _found)
|
||||
if(NOT (_found EQUAL 0))
|
||||
string(FIND "${${_cache_variable}}" "${contents}" _found)
|
||||
if(NOT (_found EQUAL -1))
|
||||
if(_found)
|
||||
unset(${_cache_variable} CACHE)
|
||||
set(_print_msg ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if(_print_msg)
|
||||
message(STATUS ${msg})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Detect update from 3.1 to 3.2 libs.
|
||||
if(UNIX AND
|
||||
DEFINED OPENEXR_VERSION AND
|
||||
|
@ -63,3 +88,12 @@ if(UNIX AND
|
|||
unset_cache_variables("^TBB")
|
||||
unset_cache_variables("^USD")
|
||||
endif()
|
||||
|
||||
if(UNIX AND (NOT APPLE) AND LIBDIR AND (EXISTS ${LIBDIR}))
|
||||
# Only search for the path if it's found on the system.
|
||||
set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
|
||||
unset_cached_varables_containting(
|
||||
"${LIBDIR_STALE}"
|
||||
"Auto clearing old ${LIBDIR_STALE} paths from CMake configuration"
|
||||
)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue