Skip to content

Commit 81b580b

Browse files
committedFeb 9, 2014
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. llvm-svn: 201047
1 parent 3097cdc commit 81b580b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed
 

Diff for: ‎llvm/cmake/modules/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ configure_file(
1515
${llvm_cmake_builddir}/LLVMConfig.cmake
1616
@ONLY)
1717

18+
# For compatibility with projects that include(LLVMConfig)
19+
# via CMAKE_MODULE_PATH, place API modules next to it.
20+
# This should be removed in the future.
21+
file(COPY .
22+
DESTINATION ${llvm_cmake_builddir}
23+
FILES_MATCHING PATTERN *.cmake
24+
PATTERN .svn EXCLUDE
25+
PATTERN CMakeFiles EXCLUDE
26+
)
27+
1828
configure_file(
1929
LLVMConfigVersion.cmake.in
2030
${llvm_cmake_builddir}/LLVMConfigVersion.cmake

Diff for: ‎llvm/cmake/modules/LLVMConfig.cmake.in

+3-13
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include)
4141
set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib)
4242
set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
4343

44-
# We try to include using the current setting of CMAKE_MODULE_PATH,
45-
# which suppossedly was filled by the user with the directory where
46-
# this file was installed:
47-
include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
48-
49-
# If failed, we assume that this is an un-installed build:
50-
if( NOT LLVMCONFIG_INCLUDED )
51-
set(CMAKE_MODULE_PATH
52-
${CMAKE_MODULE_PATH}
53-
"@LLVM_SOURCE_DIR@/cmake/modules")
54-
include( LLVM-Config )
55-
endif()
56-
44+
get_filename_component(_SELF_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
45+
include(${_SELF_DIR}/LLVM-Config.cmake)
46+
unset(_SELF_DIR)

0 commit comments

Comments
 (0)
Please sign in to comment.