Author: cbieneman
Date: Fri Nov 20 16:09:06 2015
New Revision: 253721

URL: http://llvm.org/viewvc/llvm-project?rev=253721&view=rev
Log:
[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

Modified:
    cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=253721&r1=253720&r2=253721&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Nov 20 16:09:06 2015
@@ -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


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to