aboutsummaryrefslogtreecommitdiff
path: root/libc/CMakeLists.txt
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2024-02-22 06:28:12 -0800
committerGitHub <noreply@github.com>2024-02-22 08:28:12 -0600
commit9dbedcac1243e8e99103bdff37da51dded67b766 (patch)
tree3437f48cf720e40ff6f50516f9b8fa6eb00edf26 /libc/CMakeLists.txt
parentd3f6dd6585f4866a38a794b80db55a62c1050c77 (diff)
downloadllvm-9dbedcac1243e8e99103bdff37da51dded67b766.zip
llvm-9dbedcac1243e8e99103bdff37da51dded67b766.tar.gz
llvm-9dbedcac1243e8e99103bdff37da51dded67b766.tar.bz2
[build] Check RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES for libc also (#82561)
When checking whether we need to build libc-hdrgen, we need to check LLVM_ENABLE_RUNTIMES and RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES, just the former is not sufficient since libc may be enabled only for certain targets.
Diffstat (limited to 'libc/CMakeLists.txt')
-rw-r--r--libc/CMakeLists.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 616beae..9f98394 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -57,9 +57,21 @@ if(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
endif()
endif()
+set(NEED_LIBC_HDRGEN FALSE)
+if(NOT LLVM_RUNTIMES_BUILD)
+ if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
+ set(NEED_LIBC_HDRGEN TRUE)
+ else()
+ foreach(_name ${LLVM_RUNTIME_TARGETS})
+ if("libc" IN_LIST RUNTIMES_${_name}_LLVM_ENABLE_RUNTIMES)
+ set(NEED_LIBC_HDRGEN TRUE)
+ break()
+ endif()
+ endforeach()
+ endif()
+endif()
option(LIBC_HDRGEN_ONLY "Only build the 'libc-hdrgen' executable" OFF)
-if(("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD) OR
- LIBC_HDRGEN_ONLY)
+if(LIBC_HDRGEN_ONLY OR NEED_LIBC_HDRGEN)
# When libc is build as part of the runtimes/bootstrap build's CMake run, we
# only need to build the host tools to build the libc. So, we just do enough
# to build libc-hdrgen and return.
@@ -70,6 +82,7 @@ if(("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT LLVM_RUNTIMES_BUILD) OR
endif()
return()
endif()
+unset(NEED_LIBC_HDRGEN)
option(LIBC_CMAKE_VERBOSE_LOGGING
"Log details warnings and notifications during CMake configuration." OFF)