2014-02-09 16:35:29 +00:00
|
|
|
set(LLVM_INSTALL_PACKAGE_DIR share/llvm/cmake)
|
|
|
|
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
|
2010-08-09 03:26:43 +00:00
|
|
|
|
2014-02-09 16:36:16 +00:00
|
|
|
get_property(LLVM_EXPORTS GLOBAL PROPERTY LLVM_EXPORTS)
|
|
|
|
export(TARGETS ${LLVM_EXPORTS}
|
|
|
|
FILE ${llvm_cmake_builddir}/LLVMExports.cmake)
|
|
|
|
|
2014-02-21 14:17:07 +00:00
|
|
|
get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
|
2011-02-18 22:06:14 +00:00
|
|
|
|
2014-02-21 14:17:07 +00:00
|
|
|
foreach(lib ${LLVM_AVAILABLE_LIBS})
|
2011-11-29 01:31:52 +00:00
|
|
|
get_property(llvm_lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
|
2011-07-29 23:52:01 +00:00
|
|
|
set(all_llvm_lib_deps
|
2011-11-29 01:31:52 +00:00
|
|
|
"${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib} ${llvm_lib_deps})")
|
2011-07-29 23:52:01 +00:00
|
|
|
endforeach(lib)
|
|
|
|
|
2014-02-09 16:35:51 +00:00
|
|
|
# Generate LLVMConfig.cmake for the build tree.
|
|
|
|
set(LLVM_CONFIG_CODE "
|
|
|
|
# LLVM_BUILD_* values available only from LLVM build tree.
|
|
|
|
set(LLVM_BUILD_BINARY_DIR \"${LLVM_BINARY_DIR}\")
|
|
|
|
set(LLVM_BUILD_LIBRARY_DIR \"${LLVM_LIBRARY_DIR}\")
|
|
|
|
set(LLVM_BUILD_MAIN_INCLUDE_DIR \"${LLVM_MAIN_INCLUDE_DIR}\")
|
|
|
|
set(LLVM_BUILD_MAIN_SRC_DIR \"${LLVM_MAIN_SRC_DIR}\")
|
|
|
|
")
|
|
|
|
set(LLVM_CONFIG_INCLUDE_DIRS
|
|
|
|
"${LLVM_MAIN_INCLUDE_DIR}"
|
|
|
|
"${LLVM_INCLUDE_DIR}"
|
|
|
|
)
|
|
|
|
set(LLVM_CONFIG_LIBRARY_DIRS
|
|
|
|
"${LLVM_LIBRARY_DIR}"
|
|
|
|
)
|
|
|
|
set(LLVM_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
2014-07-22 17:48:51 +00:00
|
|
|
set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
2014-02-09 16:36:28 +00:00
|
|
|
set(LLVM_CONFIG_EXPORTS_FILE "${llvm_cmake_builddir}/LLVMExports.cmake")
|
2010-08-09 03:26:43 +00:00
|
|
|
configure_file(
|
2011-04-10 16:17:49 +00:00
|
|
|
LLVMConfig.cmake.in
|
|
|
|
${llvm_cmake_builddir}/LLVMConfig.cmake
|
|
|
|
@ONLY)
|
|
|
|
|
2014-02-09 16:35:40 +00:00
|
|
|
# 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
|
|
|
|
)
|
|
|
|
|
2014-02-09 16:35:51 +00:00
|
|
|
# Generate LLVMConfig.cmake for the install tree.
|
|
|
|
set(LLVM_CONFIG_CODE "
|
|
|
|
# Compute the installation prefix from this LLVMConfig.cmake file location.
|
|
|
|
get_filename_component(LLVM_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
|
|
|
|
# Construct the proper number of get_filename_component(... PATH)
|
|
|
|
# calls to compute the installation prefix.
|
|
|
|
string(REGEX REPLACE "/" ";" _count "${LLVM_INSTALL_PACKAGE_DIR}")
|
|
|
|
foreach(p ${_count})
|
|
|
|
set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
|
|
|
|
get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
|
|
|
|
endforeach(p)
|
|
|
|
set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
|
2014-12-29 11:16:19 +00:00
|
|
|
set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
|
2014-02-09 16:35:51 +00:00
|
|
|
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
|
2014-07-22 17:48:51 +00:00
|
|
|
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
|
2014-02-09 16:36:28 +00:00
|
|
|
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
|
2014-02-09 16:35:51 +00:00
|
|
|
configure_file(
|
|
|
|
LLVMConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
|
|
|
@ONLY)
|
|
|
|
|
|
|
|
# Generate LLVMConfigVersion.cmake for build and install tree.
|
2011-04-10 16:17:49 +00:00
|
|
|
configure_file(
|
|
|
|
LLVMConfigVersion.cmake.in
|
|
|
|
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
|
2010-09-13 23:59:48 +00:00
|
|
|
@ONLY)
|
2010-08-09 03:26:43 +00:00
|
|
|
|
2013-08-24 00:20:36 +00:00
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
2014-02-10 20:44:57 +00:00
|
|
|
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
|
|
|
|
|
2013-08-24 00:20:36 +00:00
|
|
|
install(FILES
|
2014-02-09 16:35:51 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
2013-08-24 00:20:36 +00:00
|
|
|
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
|
|
|
|
LLVM-Config.cmake
|
2014-02-09 16:35:29 +00:00
|
|
|
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
|
2011-02-03 20:57:36 +00:00
|
|
|
|
2013-08-24 00:20:36 +00:00
|
|
|
install(DIRECTORY .
|
2014-02-09 16:35:29 +00:00
|
|
|
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
2013-08-24 00:20:36 +00:00
|
|
|
FILES_MATCHING PATTERN *.cmake
|
|
|
|
PATTERN .svn EXCLUDE
|
|
|
|
PATTERN LLVMConfig.cmake EXCLUDE
|
|
|
|
PATTERN LLVMConfigVersion.cmake EXCLUDE
|
|
|
|
PATTERN LLVM-Config.cmake EXCLUDE
|
|
|
|
PATTERN GetHostTriple.cmake EXCLUDE
|
|
|
|
PATTERN VersionFromVCS.cmake EXCLUDE
|
|
|
|
PATTERN CheckAtomic.cmake EXCLUDE)
|
|
|
|
endif()
|