mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Provide LLVMConfig in both build and install tree
Create separate package configuration files "LLVMConfig.cmake" for the LLVM build and install trees so that each can have information specific to its tree. Configure each with the corresponding include, lib, and cmake directories. Include the "LLVM-Config" API modules directly from the configured cmake modules directory. In the install tree, compute the installation prefix relative to the file location. In the build tree, provide information specific to the build tree for use by tools like Clang that can build externally against the LLVM build tree. Prefix such values in "LLVM_BUILD_" and comment them as such. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6574a84331
commit
24ef854ac8
@ -1,6 +1,5 @@
|
||||
set(LLVM_INSTALL_PACKAGE_DIR share/llvm/cmake)
|
||||
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
|
||||
set(LLVM_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
|
||||
|
||||
@ -10,6 +9,24 @@ foreach(lib ${llvm_libs})
|
||||
"${all_llvm_lib_deps}\nset_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib} ${llvm_lib_deps})")
|
||||
endforeach(lib)
|
||||
|
||||
# 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_ENABLE_ASSERTIONS \"${LLVM_ENABLE_ASSERTIONS}\")
|
||||
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_BUILD_TOOLS_BINARY_DIR \"${LLVM_TOOLS_BINARY_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}")
|
||||
configure_file(
|
||||
LLVMConfig.cmake.in
|
||||
${llvm_cmake_builddir}/LLVMConfig.cmake
|
||||
@ -25,6 +42,26 @@ file(COPY .
|
||||
PATTERN CMakeFiles EXCLUDE
|
||||
)
|
||||
|
||||
# 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")
|
||||
set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib")
|
||||
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
|
||||
configure_file(
|
||||
LLVMConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
||||
@ONLY)
|
||||
|
||||
# Generate LLVMConfigVersion.cmake for build and install tree.
|
||||
configure_file(
|
||||
LLVMConfigVersion.cmake.in
|
||||
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
|
||||
@ -32,7 +69,7 @@ configure_file(
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(FILES
|
||||
${llvm_cmake_builddir}/LLVMConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
||||
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
|
||||
LLVM-Config.cmake
|
||||
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
|
||||
|
@ -1,5 +1,7 @@
|
||||
# This file provides information and services to the final user.
|
||||
|
||||
@LLVM_CONFIG_CODE@
|
||||
|
||||
set(LLVM_VERSION_MAJOR @LLVM_VERSION_MAJOR@)
|
||||
set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@)
|
||||
set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
|
||||
@ -36,11 +38,9 @@ set(HAVE_LIBZ @HAVE_LIBZ@)
|
||||
set(LLVM_ON_UNIX @LLVM_ON_UNIX@)
|
||||
set(LLVM_ON_WIN32 @LLVM_ON_WIN32@)
|
||||
|
||||
set(LLVM_INSTALL_PREFIX "@LLVM_INSTALL_PREFIX@")
|
||||
set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include)
|
||||
set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib)
|
||||
set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
|
||||
set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
|
||||
set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
|
||||
set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@")
|
||||
|
||||
get_filename_component(_SELF_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
include(${_SELF_DIR}/LLVM-Config.cmake)
|
||||
unset(_SELF_DIR)
|
||||
include(${LLVM_CMAKE_DIR}/LLVM-Config.cmake)
|
||||
|
Loading…
Reference in New Issue
Block a user