[PATCH] D49672: [CMake] Honor LLVM_EXTERNAL_<proj>_SOURCE_DIR
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 23 08:26:44 PDT 2018
greened created this revision.
greened added reviewers: phosek, jordan_rose, chandlerc.
Herald added subscribers: llvm-commits, mgorny.
When LLVM_ENABLE_PROJECTS is set, CMake assumes the project directories are all side-by-side. This is not always the case and there's no reason to expect it if LLVM_EXTERNAL_<proj>_SOURCE_DIR is set. Honor that setting if it exists and allow the build configuration to continue.
Repository:
rL LLVM
https://reviews.llvm.org/D49672
Files:
CMakeLists.txt
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -128,18 +128,22 @@
set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})
endif()
foreach(proj ${LLVM_ENABLE_PROJECTS})
- set(PROJ_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
+ string(TOUPPER "${proj}" upper_proj)
+ STRING(REGEX REPLACE "-" "_" upper_proj ${upper_proj})
+ if(NOT LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR)
+ set(LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
+ endif()
+ set(PROJ_DIR "${LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR}")
if(NOT EXISTS "${PROJ_DIR}" OR NOT IS_DIRECTORY "${PROJ_DIR}")
message(FATAL_ERROR "LLVM_ENABLE_PROJECTS requests ${proj} but directory not found: ${PROJ_DIR}")
endif()
- string(TOUPPER "${proj}" upper_proj)
- STRING(REGEX REPLACE "-" "_" upper_proj ${upper_proj})
- set(LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
# There is a widely spread opinion that clang-tools-extra should be merged
# into clang. The following simulates it by always enabling clang-tools-extra
# when enabling clang.
if (proj STREQUAL "clang")
- set(LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../clang-tools-extra")
+ if(NOT LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR)
+ set(LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../clang-tools-extra")
+ endif()
endif()
endforeach()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49672.156794.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180723/b4c77ca5/attachment.bin>
More information about the llvm-commits
mailing list