[clang] 177cbb1 - [CMake] Explicit bootstrap options override any passthrough ones.

Carlos Alberto Enciso via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 17 00:17:25 PDT 2022


Author: Carlos Alberto Enciso
Date: 2022-08-17T08:16:10+01:00
New Revision: 177cbb1c9b661b15a7db35e4ec9255adf502a6cb

URL: https://github.com/llvm/llvm-project/commit/177cbb1c9b661b15a7db35e4ec9255adf502a6cb
DIFF: https://github.com/llvm/llvm-project/commit/177cbb1c9b661b15a7db35e4ec9255adf502a6cb.diff

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

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)

-DCMAKE_BUILD_TYPE=Release -DBOOTSTRAP_CMAKE_BUILD_TYPE=Debug

Reviewed By: @beanz

Differential Revision: https://reviews.llvm.org/D131755

Added: 
    

Modified: 
    clang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f6e860159435..60f6c162a2d5 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -758,6 +758,19 @@ if (CLANG_ENABLE_BOOTSTRAP)
     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 @@ if (CLANG_ENABLE_BOOTSTRAP)
     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}


        


More information about the cfe-commits mailing list