CMake: corrections on LLVM.cmake external services.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110763 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/modules/LLVM.cmake b/cmake/modules/LLVM.cmake
index b055d83..9621454 100644
--- a/cmake/modules/LLVM.cmake
+++ b/cmake/modules/LLVM.cmake
@@ -1,3 +1,5 @@
+# This file provides information and services to the final user.
+
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
set(llvm_libs @llvm_libs@)
@@ -10,10 +12,18 @@
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
-if( NOT EXISTS LLVMConfig.cmake )
+set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
+
+# We try to include using the current setting of CMAKE_MODULE_PATH,
+# which suppossedly was filled by the user with the directory where
+# this file was installed:
+include( LLVMConfig OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
+
+# If failed, we assume that this is an un-installed build:
+if( NOT LLVMCONFIG_INCLUDED )
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"@LLVM_SOURCE_DIR@/cmake/modules")
+ include( LLVMConfig )
endif()
-include( LLVMConfig )