CMake: corrections on LLVM.cmake external services.
authorOscar Fuentes <ofv@wanadoo.es>
Wed, 11 Aug 2010 00:51:32 +0000 (00:51 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Wed, 11 Aug 2010 00:51:32 +0000 (00:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110763 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/CMakeLists.txt
cmake/modules/LLVM.cmake
cmake/modules/LLVMConfig.cmake

index 03b1e83da25ba6427abe7048e1fc8a5422b9d3e5..416d7f4785641de0c7f86412ae24a596a9dfd1a8 100644 (file)
@@ -2,7 +2,8 @@ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake")
 
 configure_file(
   LLVM.cmake
-  ${llvm_cmake_builddir}/LLVM.cmake)
+  ${llvm_cmake_builddir}/LLVM.cmake
+  @ONLY)
 
 install(FILES
   ${llvm_cmake_builddir}/LLVM.cmake
index b055d83f91893470a6bbae27554a610ec638ab6f..9621454f411912a512f0fcd58a18151eac118ea3 100644 (file)
@@ -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_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
 
 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 )
index c623bfaba8d123aceecbf5d7d6cbf3e406232f29..328aebf4b6da7c1155f4b4d237a2a414fef5245f 100755 (executable)
@@ -53,7 +53,7 @@ endfunction(explicit_llvm_config)
 function(llvm_map_components_to_libraries OUT_VAR)
   explicit_map_components_to_libraries(result ${ARGN})
   get_system_libs(sys_result)
-  set( ${OUT_VAR} ${result} ${sys_result} )
+  set( ${OUT_VAR} ${result} ${sys_result} PARENT_SCOPE )
 endfunction(llvm_map_components_to_libraries)