[PATCH] D62353: [cmake] Add new LLVM_CACHE_VARIABLES variable to contains all variables passed to cmake on the commandline or in cache files.

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 16:26:18 PDT 2019


hintonda updated this revision to Diff 201087.
hintonda added a comment.

- Fix typo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62353/new/

https://reviews.llvm.org/D62353

Files:
  llvm/CMakeLists.txt


Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1,5 +1,30 @@
 # See docs/CMake.html for instructions about how to build LLVM with CMake.
 
+# Generate a list of variables passed to cmake and save the list in
+# the cache.  This list could be used to figure out what should when
+# building host tools for cross-compiles.
+# TODO: We could compare the list to the previous run, issue
+# diagnostics and save the new list, but not sure that's worthwhile.
+if(NOT LLVM_CACHE_VARIABLES)
+  # Needed for IN_LIST below
+  if(POLICY CMP0057)
+    cmake_policy(SET CMP0057 NEW)
+  endif()
+  set(IGNORE_LIST CMAKE_COMMAND CMAKE_CPACK_COMMAND CMAKE_CTEST_COMMAND CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_HOME_DIRECTORY CMAKE_ROOT)
+  message(STATUS "*** Gathering initial cache variables -- from command line and/or cache files into LLVM_CACHE_VARIABLES ***")
+  get_cmake_property(vars CACHE_VARIABLES)
+  foreach(var ${vars})
+    if(var IN_LIST IGNORE_LIST)
+      continue()
+    endif()
+    list(APPEND LLVM_CACHE_VARIABLES ${var})
+  endforeach()
+  set(LLVM_CACHE_VARIABLES ${LLVM_CACHE_VARIABLES} CACHE STRING "List of variables passed to cmake on the commandline or in cache files." FORCE)
+  foreach(var ${LLVM_CACHE_VARIABLES})
+    message(STATUS "from commandline or cache files: ${var} = ${${var}}")
+  endforeach()
+endif()
+
 cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0068)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62353.201087.patch
Type: text/x-patch
Size: 1507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190523/dd6a2668/attachment.bin>


More information about the llvm-commits mailing list