File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,26 @@ get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
88export (TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir} /ClangTargets.cmake)
99
1010# Generate ClangConfig.cmake for the build tree.
11+ set (CLANG_CONFIG_CMAKE_DIR "${clang_cmake_builddir} " )
12+ set (CLANG_CONFIG_EXPORTS_FILE "${clang_cmake_builddir} /ClangTargets.cmake" )
1113configure_file (
1214 ${CMAKE_CURRENT_SOURCE_DIR} /ClangConfig.cmake.in
1315 ${clang_cmake_builddir} /ClangConfig.cmake
1416 @ONLY)
1517
1618# Generate ClangConfig.cmake for the install tree.
19+ set (CLANG_CONFIG_CODE "
20+ # Compute the installation prefix from this LLVMConfig.cmake file location.
21+ get_filename_component(CLANG_INSTALL_PREFIX \"\$ {CMAKE_CURRENT_LIST_FILE}\" PATH)" )
22+ # Construct the proper number of get_filename_component(... PATH)
23+ # calls to compute the installation prefix.
24+ string (REGEX REPLACE "/" ";" _count "${CLANG_INSTALL_PACKAGE_DIR} " )
25+ foreach (p ${_count} )
26+ set (CLANG_CONFIG_CODE "${CLANG_CONFIG_CODE}
27+ get_filename_component(CLANG_INSTALL_PREFIX \"\$ {CLANG_INSTALL_PREFIX}\" PATH)" )
28+ endforeach (p)
29+ set (CLANG_CONFIG_CMAKE_DIR "\$ {CLANG_INSTALL_PREFIX}/\$ {CLANG_INSTALL_PACKAGE_DIR}" )
30+ set (CLANG_CONFIG_EXPORTS_FILE "\$ {CLANG_CMAKE_DIR}/ClangTargets.cmake" )
1731configure_file (
1832 ${CMAKE_CURRENT_SOURCE_DIR} /ClangConfig.cmake.in
1933 ${CMAKE_CURRENT_BINARY_DIR} /CMakeFiles/ClangConfig.cmake
Original file line number Diff line number Diff line change 66
77find_package (LLVM REQUIRED CONFIG)
88
9+ @CLANG_CONFIG_CODE@
10+
11+ set (CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@" )
12+
913# Provide all our library targets to users.
10- include ("${CMAKE_CURRENT_LIST_DIR} /ClangTargets.cmake " )
14+ include ("@CLANG_CONFIG_EXPORTS_FILE@ " )
You can’t perform that action at this time.
0 commit comments