Skip to content

Commit

Permalink
[CMake] Support passing arguments to build tool (bootstrap).
Browse files Browse the repository at this point in the history
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
  • Loading branch information
CarlosAlbertoEnciso committed Aug 23, 2022
1 parent b88aba9 commit 6c6c4f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions clang/CMakeLists.txt
Expand Up @@ -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}
Expand All @@ -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
Expand Down

0 comments on commit 6c6c4f6

Please sign in to comment.