[PATCH] D29304: [cmake] Hint find_package() to prefer LLVM installed alongside clang
Michał Górny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 31 06:27:06 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293632: [cmake] Hint find_package() to prefer LLVM installed alongside clang (authored by mgorny).
Changed prior to commit:
https://reviews.llvm.org/D29304?vs=86339&id=86421#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29304
Files:
cfe/trunk/cmake/modules/CMakeLists.txt
cfe/trunk/cmake/modules/ClangConfig.cmake.in
Index: cfe/trunk/cmake/modules/ClangConfig.cmake.in
===================================================================
--- cfe/trunk/cmake/modules/ClangConfig.cmake.in
+++ cfe/trunk/cmake/modules/ClangConfig.cmake.in
@@ -1,9 +1,10 @@
# This file allows users to call find_package(Clang) and pick up our targets.
-find_package(LLVM REQUIRED CONFIG)
-
@CLANG_CONFIG_CODE@
+find_package(LLVM REQUIRED CONFIG
+ HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")
+
set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")
set(CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@")
Index: cfe/trunk/cmake/modules/CMakeLists.txt
===================================================================
--- cfe/trunk/cmake/modules/CMakeLists.txt
+++ cfe/trunk/cmake/modules/CMakeLists.txt
@@ -4,17 +4,23 @@
set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+# Keep this in sync with llvm/cmake/CMakeLists.txt!
+set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)
# Generate ClangConfig.cmake for the build tree.
set(CLANG_CONFIG_CMAKE_DIR "${clang_cmake_builddir}")
+set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
set(CLANG_CONFIG_EXPORTS_FILE "${clang_cmake_builddir}/ClangTargets.cmake")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
${clang_cmake_builddir}/ClangConfig.cmake
@ONLY)
set(CLANG_CONFIG_CMAKE_DIR)
+set(CLANG_CONFIG_LLVM_CMAKE_DIR)
set(CLANG_CONFIG_EXPORTS_FILE)
# Generate ClangConfig.cmake for the install tree.
@@ -29,6 +35,7 @@
get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)")
endforeach(p)
set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}")
+set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29304.86421.patch
Type: text/x-patch
Size: 2217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170131/23b4c830/attachment.bin>
More information about the cfe-commits
mailing list