[PATCH] D131755: [CMake] Explicit bootstrap options override any passthrough ones.

Carlos Alberto Enciso via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 02:30:14 PDT 2022


CarlosAlbertoEnciso created this revision.
CarlosAlbertoEnciso added reviewers: sylvestre.ledru, andrewng, russell.gallop, phosek, beanz.
CarlosAlbertoEnciso added projects: All, LLVM, clang.
Herald added a subscriber: mgorny.
CarlosAlbertoEnciso requested review of this revision.
Herald added a subscriber: cfe-commits.

The https://reviews.llvm.org/D53014 added CMAKE_BUILD_TYPE to 
the list of BOOTSTRAP_DEFAULT_PASSTHROUGH variables.

The downside is that both stage-1 and stage-2 configurations
are the same. So it is not possible to build different stage
configurations.

This patch allow explicit bootstrap options to override any 
passthrough ones.

For instance, the following settings would build:
stage-1 (Release) and stage-2 (Debug)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131755

Files:
  clang/CMakeLists.txt


Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -758,6 +758,19 @@
     set(LTO_RANLIB)
   endif()
 
+  # Populate the passthrough variables
+  foreach(variableName ${CLANG_BOOTSTRAP_PASSTHROUGH} ${_BOOTSTRAP_DEFAULT_PASSTHROUGH})
+    if(DEFINED ${variableName})
+      if("${${variableName}}" STREQUAL "")
+        set(value "")
+      else()
+        string(REPLACE ";" "|" value "${${variableName}}")
+      endif()
+      list(APPEND PASSTHROUGH_VARIABLES
+        -D${variableName}=${value})
+    endif()
+  endforeach()
+
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -774,19 +787,6 @@
     endif()
   endforeach()
 
-  # Populate the passthrough variables
-  foreach(variableName ${CLANG_BOOTSTRAP_PASSTHROUGH} ${_BOOTSTRAP_DEFAULT_PASSTHROUGH})
-    if(DEFINED ${variableName})
-      if("${${variableName}}" STREQUAL "")
-        set(value "")
-      else()
-        string(REPLACE ";" "|" value "${${variableName}}")
-      endif()
-      list(APPEND PASSTHROUGH_VARIABLES
-        -D${variableName}=${value})
-    endif()
-  endforeach()
-
   ExternalProject_Add(${NEXT_CLANG_STAGE}
     DEPENDS clang-bootstrap-deps
     PREFIX ${NEXT_CLANG_STAGE}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131755.452114.patch
Type: text/x-patch
Size: 1356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220812/bab7fd96/attachment.bin>


More information about the cfe-commits mailing list