2020-09-18 12:05:01 +03:00
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
set ( CLING_INSTALL_PACKAGE_DIR lib ${ LLVM_LIBDIR_SUFFIX } /cmake/cling )
2023-01-29 03:08:29 +03:00
set ( cling_cmake_builddir "${CLING_BINARY_DIR}/${CLING_INSTALL_PACKAGE_DIR}" )
2020-09-18 12:05:01 +03:00
# 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 ( CLING_EXPORTS GLOBAL PROPERTY CLING_EXPORTS )
export ( TARGETS ${ CLING_EXPORTS } FILE ${ cling_cmake_builddir } /ClingTargets.cmake )
# Generate ClingConfig.cmake for the build tree.
set ( CLING_CONFIG_CMAKE_DIR "${cling_cmake_builddir}" )
set ( CLING_CONFIG_CLANG_CMAKE_DIR "${clang_cmake_builddir}" )
set ( CLING_CONFIG_EXPORTS_FILE "${cling_cmake_builddir}/ClingTargets.cmake" )
set ( CLING_CONFIG_INCLUDE_DIRS
" $ { C L I N G _ S O U R C E _ D I R } / i n c l u d e "
" $ { C L I N G _ B I N A R Y _ D I R } / i n c l u d e "
)
configure_file (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C l i n g C o n f i g . c m a k e . i n
$ { c l i n g _ c m a k e _ b u i l d d i r } / C l i n g C o n f i g . c m a k e
@ O N L Y )
set ( CLING_CONFIG_CMAKE_DIR )
set ( CLING_CONFIG_LLVM_CMAKE_DIR )
set ( CLING_CONFIG_EXPORTS_FILE )
# Generate ClingConfig.cmake for the install tree.
set ( CLING_CONFIG_CODE "
# Compute the installation prefix from this LLVMConfig.cmake file location.
get_filename_component ( CLING_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 "${CLING_INSTALL_PACKAGE_DIR}" )
foreach ( p ${ _count } )
set ( CLING_CONFIG_CODE " ${ CLING_CONFIG_CODE }
get_filename_component ( CLING_INSTALL_PREFIX \"\${CLING_INSTALL_PREFIX}\" PATH ) " )
endforeach ( p )
set ( CLING_CONFIG_CMAKE_DIR "\${CLING_INSTALL_PREFIX}/${CLING_INSTALL_PACKAGE_DIR}" )
set ( CLING_CONFIG_LLVM_CMAKE_DIR "\${CLING_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}" )
set ( CLING_CONFIG_EXPORTS_FILE "\${CLING_CMAKE_DIR}/ClingTargets.cmake" )
set ( CLING_CONFIG_INCLUDE_DIRS
" \ $ { C L I N G _ I N S T A L L _ P R E F I X } / i n c l u d e "
)
configure_file (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C l i n g C o n f i g . c m a k e . i n
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / C M a k e F i l e s / C l i n g C o n f i g . c m a k e
@ O N L Y )
set ( CLING_CONFIG_CODE )
set ( CLING_CONFIG_CMAKE_DIR )
set ( CLING_CONFIG_EXPORTS_FILE )
if ( NOT LLVM_INSTALL_TOOLCHAIN_ONLY )
2022-03-27 10:52:03 +03:00
install ( EXPORT ClingTargets DESTINATION ${ CLING_INSTALL_PACKAGE_DIR }
C O M P O N E N T c l i n g - c m a k e - e x p o r t s )
2020-09-18 12:05:01 +03:00
install ( FILES
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / C M a k e F i l e s / C l i n g C o n f i g . c m a k e
D E S T I N A T I O N $ { C L I N G _ I N S T A L L _ P A C K A G E _ D I R }
C O M P O N E N T c l i n g - c m a k e - e x p o r t s )
if ( NOT LLVM_ENABLE_IDE )
# Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS
add_custom_target ( cling-cmake-exports )
add_llvm_install_targets ( install-cling-cmake-exports
C O M P O N E N T c l i n g - c m a k e - e x p o r t s )
endif ( )
endif ( )