summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/CMakeLists.txt6
-rw-r--r--libc/utils/HdrGen/CMakeLists.txt2
-rw-r--r--libc/utils/LibcTableGenUtil/CMakeLists.txt2
3 files changed, 8 insertions, 2 deletions
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index eff5e00453f5..377c871eb242 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -14,6 +14,12 @@ set(LIBC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
# The top-level directory in which libc is being built.
set(LIBC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
+# For a runtimes build we need to manually include tablgen and LLVM directories.
+if ("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
+ include(TableGen)
+ set(LLVM_LIBC_INCLUDE_DIRS ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_BINARY_DIR}/include)
+endif()
+
# Path libc/scripts directory.
set(LIBC_BUILD_SCRIPTS_DIR "${LIBC_SOURCE_DIR}/utils/build_scripts")
diff --git a/libc/utils/HdrGen/CMakeLists.txt b/libc/utils/HdrGen/CMakeLists.txt
index 75192a057af4..1b361f407f7f 100644
--- a/libc/utils/HdrGen/CMakeLists.txt
+++ b/libc/utils/HdrGen/CMakeLists.txt
@@ -12,7 +12,7 @@ add_tablegen(libc-hdrgen LIBC
PublicAPICommand.h
)
-target_include_directories(libc-hdrgen PRIVATE ${LIBC_SOURCE_DIR})
+target_include_directories(libc-hdrgen PRIVATE ${LIBC_SOURCE_DIR} ${LLVM_LIBC_INCLUDE_DIRS})
target_link_libraries(libc-hdrgen PRIVATE LibcTableGenUtil)
add_subdirectory(PrototypeTestGen)
diff --git a/libc/utils/LibcTableGenUtil/CMakeLists.txt b/libc/utils/LibcTableGenUtil/CMakeLists.txt
index d2632a240bd3..41881e78da23 100644
--- a/libc/utils/LibcTableGenUtil/CMakeLists.txt
+++ b/libc/utils/LibcTableGenUtil/CMakeLists.txt
@@ -4,4 +4,4 @@ add_llvm_library(
APIIndexer.h
LINK_COMPONENTS Support TableGen
)
-target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR})
+target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR} ${LLVM_LIBC_INCLUDE_DIRS})