From 6574a84331530911502c2f02732299a1ca93ab07 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 9 Feb 2014 16:35:40 +0000 Subject: [PATCH] Teach LLVMConfig to avoid modifying CMAKE_MODULE_PATH Do not modify this value on the application's behalf and just ensure API modules are always available next to the LLVMConfig module. This is already the case in the install tree so use file(COPY) to make it so in the build tree. Include the LLVM-Config API module from next to the LLVMConfig location. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201047 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/CMakeLists.txt | 10 ++++++++++ cmake/modules/LLVMConfig.cmake.in | 16 +++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index b48018d51f9..169418c6b9b 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -15,6 +15,16 @@ configure_file( ${llvm_cmake_builddir}/LLVMConfig.cmake @ONLY) +# For compatibility with projects that include(LLVMConfig) +# via CMAKE_MODULE_PATH, place API modules next to it. +# This should be removed in the future. +file(COPY . + DESTINATION ${llvm_cmake_builddir} + FILES_MATCHING PATTERN *.cmake + PATTERN .svn EXCLUDE + PATTERN CMakeFiles EXCLUDE + ) + configure_file( LLVMConfigVersion.cmake.in ${llvm_cmake_builddir}/LLVMConfigVersion.cmake diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in index 5e38d82f599..224a26352d3 100644 --- a/cmake/modules/LLVMConfig.cmake.in +++ b/cmake/modules/LLVMConfig.cmake.in @@ -41,16 +41,6 @@ set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include) set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib) set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS") -# 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( LLVM-Config 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( LLVM-Config ) -endif() - +get_filename_component(_SELF_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +include(${_SELF_DIR}/LLVM-Config.cmake) +unset(_SELF_DIR) -- 2.34.1