[cmake] Honor CMAKE_VERBOSE_MAKEFILE when building external projects (#75749)
When the top-level CMake invocation has `CMAKE_VERBOSE_MAKEFILE=ON`, indicating the user wants to have verbose builds (i.e. all executed commands explicitly echoed), some of the subprojects and runtimes (such as compiler-rt, libcxx, etc) do not build in verbose mode. For example, with Ninja: ``` [ 99% 6252/6308] cd /build/runtimes/builtins-bins && /usr/local/bin/cmake --build . [ 0% 6/308] Building C object CMakeFiles/clang_rt.builtins-i386.dir/absvti2.c.o [ 0% 7/308] Building C object CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o [ 0% 8/308] Building C object CMakeFiles/clang_rt.builtins-i386.dir/absvsi2.c.o ... ``` This is because `llvm_ExternalProject_Add()` and `add_custom_libcxx()` use CMake's `ExternalProject_Add()` function to configure such subproject builds, and do not pass through the `CMAKE_VERBOSE_MAKEFILE` setting. Similar to what is done in `clang/CMakeLists.txt`, add `-DCMAKE_VERBOSE_MAKEFILE=ON` to the `ExternalProject_Add()` invocations in `llvm_ExternalProject_Add()` and `add_custom_libcxx()`, whenever the top-level CMake invocation had `CMAKE_VERBOSE_MAKEFILE` turned on.
This commit is contained in:
parent
c014454f43
commit
aad5c2f887
@ -670,6 +670,10 @@ macro(add_custom_libcxx name prefix)
|
||||
get_property(CXX_FLAGS CACHE CMAKE_CXX_FLAGS PROPERTY VALUE)
|
||||
set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} ${CXX_FLAGS}")
|
||||
|
||||
if(CMAKE_VERBOSE_MAKEFILE)
|
||||
set(verbose -DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(${name}
|
||||
DEPENDS ${name}-clobber ${LIBCXX_DEPS}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${name}
|
||||
@ -677,6 +681,7 @@ macro(add_custom_libcxx name prefix)
|
||||
BINARY_DIR ${prefix}
|
||||
CMAKE_ARGS ${CMAKE_PASSTHROUGH_VARIABLES}
|
||||
${compiler_args}
|
||||
${verbose}
|
||||
-DCMAKE_C_FLAGS=${LIBCXX_C_FLAGS}
|
||||
-DCMAKE_CXX_FLAGS=${LIBCXX_CXX_FLAGS}
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -319,6 +319,10 @@ function(llvm_ExternalProject_Add name source_dir)
|
||||
list(APPEND compiler_args -DCMAKE_ASM_COMPILER_TARGET=${ARG_TARGET_TRIPLE})
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE_MAKEFILE)
|
||||
set(verbose -DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(${name}
|
||||
DEPENDS ${ARG_DEPENDS} llvm-config
|
||||
${name}-clobber
|
||||
@ -330,6 +334,7 @@ function(llvm_ExternalProject_Add name source_dir)
|
||||
CMAKE_ARGS ${${nameCanon}_CMAKE_ARGS}
|
||||
--no-warn-unused-cli
|
||||
${compiler_args}
|
||||
${verbose}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||
${sysroot_arg}
|
||||
-DLLVM_BINARY_DIR=${PROJECT_BINARY_DIR}
|
||||
|
Loading…
x
Reference in New Issue
Block a user