mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Export xlnt::xlnt target when installed.
Usage: find_package(Xlnt) target_link_libraries(foo PRIVATE xlnt::xlnt)
This commit is contained in:
parent
8f39375f4c
commit
ecf402972b
13
cmake/XlntConfig.cmake.in
Normal file
13
cmake/XlntConfig.cmake.in
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
set(XLNT_VERSION "@xlnt_VERSION@")
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
get_filename_component(XLNT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
|
set_and_check(XLNT_INCLUDE_DIR "@XLNT_INCLUDE_INSTALL_DIR@")
|
||||||
|
|
||||||
|
check_required_components(xlnt)
|
||||||
|
|
||||||
|
if(NOT TARGET xlnt::xlnt)
|
||||||
|
include("${XLNT_CMAKE_DIR}/XlntTargets.cmake")
|
||||||
|
endif()
|
|
@ -159,7 +159,9 @@ endif()
|
||||||
#target_compile_features(xlnt PUBLIC cxx_std_${XLNT_CXX_LANG})
|
#target_compile_features(xlnt PUBLIC cxx_std_${XLNT_CXX_LANG})
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
target_include_directories(xlnt PUBLIC ${XLNT_INCLUDE_DIR})
|
target_include_directories(xlnt PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${XLNT_INCLUDE_DIR}>
|
||||||
|
$<INSTALL_INTERFACE:include>)
|
||||||
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR})
|
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR})
|
||||||
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}/../third-party/libstudxml)
|
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}/../third-party/libstudxml)
|
||||||
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}/../third-party/utfcpp)
|
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}/../third-party/utfcpp)
|
||||||
|
@ -236,11 +238,33 @@ if(NOT MAN_DEST_DIR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Install library
|
# Install library
|
||||||
install(TARGETS xlnt
|
install(TARGETS xlnt EXPORT XlntTargets
|
||||||
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
||||||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||||
RUNTIME DESTINATION ${BIN_DEST_DIR})
|
RUNTIME DESTINATION ${BIN_DEST_DIR})
|
||||||
|
|
||||||
|
install(EXPORT XlntTargets
|
||||||
|
FILE XlntTargets.cmake
|
||||||
|
NAMESPACE xlnt::
|
||||||
|
DESTINATION lib/cmake/xlnt)
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
set(XLNT_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/)
|
||||||
|
|
||||||
|
configure_package_config_file(../cmake/XlntConfig.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/XlntConfig.cmake
|
||||||
|
INSTALL_DESTINATION lib/cmake/xlnt
|
||||||
|
PATH_VARS XLNT_INCLUDE_DIR)
|
||||||
|
|
||||||
|
write_basic_package_version_file(XlntConfigVersion.cmake
|
||||||
|
COMPATIBILITY ExactVersion)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/XlntConfig.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/XlntConfigVersion.cmake
|
||||||
|
DESTINATION lib/cmake/xlnt)
|
||||||
|
|
||||||
# Install include directory
|
# Install include directory
|
||||||
install(DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
|
install(DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
|
||||||
DESTINATION include
|
DESTINATION include
|
||||||
|
|
Loading…
Reference in New Issue
Block a user