[clang] 6c6c4f6 - [CMake] Support passing arguments to build tool (bootstrap).

Carlos Alberto Enciso via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 21:46:37 PDT 2022


Author: Carlos Alberto Enciso
Date: 2022-08-23T05:45:25+01:00
New Revision: 6c6c4f6a9b3ef2d7db937cb78784245ea8a61418

URL: https://github.com/llvm/llvm-project/commit/6c6c4f6a9b3ef2d7db937cb78784245ea8a61418
DIFF: https://github.com/llvm/llvm-project/commit/6c6c4f6a9b3ef2d7db937cb78784245ea8a61418.diff

LOG: [CMake] Support passing arguments to build tool (bootstrap).

For bootstrap builds (CLANG_ENABLE_BOOTSTRAP=ON) allow
arguments to be passed to the native tool used in CMake
for the stage2 step.

Can be used to pass extra arguments for enhanced versions
of build tools, e.g. distributed build options.

Reviewed By: phosek

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

Added: 
    

Modified: 
    clang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index a6782db7b580..332df8f3b8bf 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -787,6 +787,14 @@ if (CLANG_ENABLE_BOOTSTRAP)
     endif()
   endforeach()
 
+  # Build arguments for native tool used in CMake.
+  set(build_configuration "$<CONFIG>")
+  set(build_tool_args "${LLVM_EXTERNAL_PROJECT_BUILD_TOOL_ARGS}")
+  if(NOT build_tool_args STREQUAL "")
+    string(PREPEND build_tool_args "-- ")
+    separate_arguments(build_tool_args UNIX_COMMAND "${build_tool_args}")
+  endif()
+
   ExternalProject_Add(${NEXT_CLANG_STAGE}
     DEPENDS clang-bootstrap-deps
     PREFIX ${NEXT_CLANG_STAGE}
@@ -809,6 +817,9 @@ if (CLANG_ENABLE_BOOTSTRAP)
                 ${${CLANG_STAGE}_RANLIB}
                 ${${CLANG_STAGE}_OBJCOPY}
                 ${${CLANG_STAGE}_STRIP}
+    BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR}
+                                   --config ${build_configuration}
+                                   ${build_tool_args}
     INSTALL_COMMAND ""
     STEP_TARGETS configure build
     USES_TERMINAL_CONFIGURE 1


        


More information about the cfe-commits mailing list