[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
This commit is contained in:
Carlos Alberto Enciso 2022-08-17 08:16:10 +01:00
parent 4c244b2833
commit 177cbb1c9b
1 changed files with 13 additions and 13 deletions

View File

@ -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}