[CMake] Unbreak add_llvm_external_project when external projects are specified.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 14 Jul 2015 05:12:53 +0000 (05:12 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 14 Jul 2015 05:12:53 +0000 (05:12 +0000)
LLVM_EXTERNAL_*_SOURCE_DIR is reset as PATH with set(CACHE PATH).
Then the CACHE PATH variable, LLVM_EXTERNAL_*_SOURCE_DIR, is normalized as
${CMAKE_SOURCE_DIR}/${path_var} if ${path_var} is relative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242120 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index 5e13b17..45f6746 100644 (file)
@@ -696,6 +696,9 @@ macro(add_llvm_external_project name)
   endif()
   if(NOT LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR)
     set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}")
+  else()
+    set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR
+        CACHE PATH "Path to ${name} source directory")
   endif()
   if (EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)
     option(LLVM_EXTERNAL_${nameUPPER}_BUILD