From 3bec932e7f366573e89893e898a5c4dfe8061a33 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 20 Nov 2015 22:09:06 +0000 Subject: [PATCH] [CMake] Add support for specifying arguments to the bootstrap build. This adds support for three types of argument specifications for bootstrap builds: (1) Arguments prefixed with BOOTSTRAP_* will be passed through with the leading BOOTSTRAP_ removed. (2) CLANG_BOOTSTRAP_PASSTHROUGH can specify a list of variables to be passed through as they are set. (3) BOOTSTRAP_DEFAULT_PASSTHROUGH is a list of some default passthrough variables that are always passed through. Those variables include the version string and should only specify variables that are always expected to be the same between the stage1 and stage2 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253721 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbc87510de..bddc25034b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -652,6 +652,36 @@ if (CLANG_ENABLE_BOOTSTRAP) set(verbose -DCMAKE_VERBOSE_MAKEFILE=On) endif() + set(BOOTSTRAP_DEFAULT_PASSTHROUGH + PACKAGE_VERSION + LLVM_VERSION_MAJOR + LLVM_VERSION_MINOR + LLVM_VERSION_PATCH + LLVM_VERSION_SUFFIX + CLANG_REPOSITORY_STRING + CMAKE_MAKE_PROGRAM) + + # Find all variables that start with BOOTSTRAP_ and populate a variable with + # them. + get_cmake_property(variableNames VARIABLES) + foreach(varaibleName ${variableNames}) + if(varaibleName MATCHES "^BOOTSTRAP_") + string(SUBSTRING ${varaibleName} 10 -1 varName) + string(REPLACE ";" "\;" value "${${varaibleName}}") + list(APPEND PASSTHROUGH_VARIABLES + -D${varName}=${value}) + endif() + endforeach() + + # Populate the passthrough variables + foreach(varaibleName ${CLANG_BOOTSTRAP_PASSTHROUGH} ${BOOTSTRAP_DEFAULT_PASSTHROUGH}) + if(${varaibleName}) + string(REPLACE ";" "\;" value ${${varaibleName}}) + list(APPEND PASSTHROUGH_VARIABLES + -D${varaibleName}=${value}) + endif() + endforeach() + ExternalProject_Add(bootstrap DEPENDS clang ${LTO_DEP} PREFIX bootstrap @@ -664,6 +694,7 @@ if (CLANG_ENABLE_BOOTSTRAP) # seem to work, so instead I'm passing this through -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${CLANG_BOOTSTRAP_CMAKE_ARGS} + ${PASSTHROUGH_VARIABLES} -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++ -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang -- 2.40.0