summaryrefslogtreecommitdiff
path: root/lld/CMakeLists.txt
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-07-26 07:17:30 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-07-28 19:36:40 -0400
commitcc56a5022c94710d8393f1505f925494f7d2cc1c (patch)
tree6b50804f87be9b42339f5c39d3fbae37bf6332a5 /lld/CMakeLists.txt
parent2e6b6522296e40304ccd2766ad3233af8a0851bb (diff)
downloadllvm-cc56a5022c94710d8393f1505f925494f7d2cc1c.tar.gz
[clang][lld][cmake] Simplify header dirs
We don't need to recompute the list LLVMConfig.cmake provides us. When LLVM is being built, the list is two elements long: generated headers and headers from source. When LLVM is already built,the list is one element long: the installed header directory containing both generated and hand-written sources. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D130553
Diffstat (limited to 'lld/CMakeLists.txt')
-rw-r--r--lld/CMakeLists.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index dcc649629a4b..58dca54642e4 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -70,13 +70,15 @@ if(LLD_BUILT_STANDALONE)
if (NOT LLVM_CONFIG_FOUND)
# Pull values from LLVMConfig.cmake. We can drop this once the llvm-config
# path is removed.
- set(MAIN_INCLUDE_DIR "${LLVM_INCLUDE_DIR}")
+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}")
# N.B. this is just a default value, the CACHE PATHs below can be overridden.
set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm")
+ else()
+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}")
endif()
- set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include")
+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed")
set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree")
@@ -95,7 +97,7 @@ if(LLD_BUILT_STANDALONE)
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
- include_directories("${LLVM_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS})
+ include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
if(LLVM_INCLUDE_TESTS)