[llvm] aad5c2f - [cmake] Honor CMAKE_VERBOSE_MAKEFILE when building external projects (#75749)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 17 13:43:39 PST 2023
Author: Dimitry Andric
Date: 2023-12-17T22:43:34+01:00
New Revision: aad5c2f887d3cd1c69f798186e6502f0ed6e3dde
URL: https://github.com/llvm/llvm-project/commit/aad5c2f887d3cd1c69f798186e6502f0ed6e3dde
DIFF: https://github.com/llvm/llvm-project/commit/aad5c2f887d3cd1c69f798186e6502f0ed6e3dde.diff
LOG: [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.
Added:
Modified:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
llvm/cmake/modules/LLVMExternalProjectUtils.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 4d9b68a3cc25bf..7aca0abc637d4e 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -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
diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 4b5b600307ec93..2089f979acd008 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -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}
More information about the llvm-commits
mailing list