[Bf-blender-cvs] [65d8da97b8b] master: Build: clear old linux centos7 cache variables instead of printing them
Brecht Van Lommel
noreply at git.blender.org
Wed Jan 4 11:24:50 CET 2023
Commit: 65d8da97b8b6f24a6503ad7ad74cc4381f5d85b4
Author: Brecht Van Lommel
Date: Wed Jan 4 10:26:03 2023 +0100
Branches: master
https://developer.blender.org/rB65d8da97b8b6f24a6503ad7ad74cc4381f5d85b4
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.
===================================================================
M CMakeLists.txt
M build_files/cmake/macros.cmake
M build_files/cmake/platform/platform_old_libs_update.cmake
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index acfab6ffc60..b68fd630748 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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})
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index b632cb9c551..9965f892395 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -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
)
diff --git a/build_files/cmake/platform/platform_old_libs_update.cmake b/build_files/cmake/platform/platform_old_libs_update.cmake
index c51029ab570..12ab9a44cf1 100644
--- a/build_files/cmake/platform/platform_old_libs_update.cmake
+++ b/build_files/cmake/platform/platform_old_libs_update.cmake
@@ -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()
More information about the Bf-blender-cvs
mailing list