From: Yuanfang Chen Date: Fri, 26 Jul 2019 19:25:57 +0000 (+0000) Subject: [CMake] Allow LLVM_EXTERNAL__SOURCE_DIR to be overridden if it is X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91bd0c818683d255f10d776c272a2806a90272de;p=llvm [CMake] Allow LLVM_EXTERNAL__SOURCE_DIR to be overridden if it is empty. This makes adding projects to LLVM_ENABLE_PROJECTS possible. Also its type should be PATH. https://bugs.llvm.org/show_bug.cgi?id=42698 Reviewers: beanz, greened, chapuni Reviewed by: beanz Differential Revision: https://reviews.llvm.org/D65045 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367144 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b9a49496222..642732ffe80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,11 @@ if (LLVM_ENABLE_PROJECTS_USED OR NOT LLVM_ENABLE_PROJECTS STREQUAL "") 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() - set(LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}" CACHE STRING "") + if( LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR STREQUAL "" ) + set(LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}" CACHE PATH "" FORCE) + else() + set(LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}" CACHE PATH "") + endif() elseif ("${proj}" IN_LIST LLVM_EXTERNAL_PROJECTS) message(STATUS "${proj} project is enabled") set(SHOULD_ENABLE_PROJECT TRUE)