mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge branch 'dev' of github.com:tfussell/xlnt into dev
This commit is contained in:
commit
1e52c06376
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()
|
|
@ -98,6 +98,7 @@ file(GLOB DETAIL_NUMBER_FORMAT_SOURCES ${XLNT_SOURCE_DIR}/detail/number_format/*
|
|||
file(GLOB DETAIL_SERIALIZATION_HEADERS ${XLNT_SOURCE_DIR}/detail/serialization/*.hpp)
|
||||
file(GLOB DETAIL_SERIALIZATION_SOURCES ${XLNT_SOURCE_DIR}/detail/serialization/*.cpp)
|
||||
|
||||
|
||||
set(DETAIL_HEADERS ${DETAIL_ROOT_HEADERS} ${DETAIL_CRYPTOGRAPHY_HEADERS}
|
||||
${DETAIL_EXTERNAL_HEADERS} ${DETAIL_HEADER_FOOTER_HEADERS}
|
||||
${DETAIL_IMPLEMENTATIONS_HEADERS} ${DETAIL_NUMBER_FORMAT_HEADERS}
|
||||
|
@ -135,6 +136,19 @@ endif()
|
|||
# Append "d" to the name of the compiled library
|
||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(XLNT_INC_DEST_DIR ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
CACHE PATH "Default location to install include files")
|
||||
set(XLNT_LIB_DEST_DIR ${CMAKE_INSTALL_LIBDIR}
|
||||
CACHE PATH "Default location to install library files")
|
||||
set(XLNT_BIN_DEST_DIR ${CMAKE_INSTALL_BINDIR}
|
||||
CACHE PATH "Default location to install runtime files")
|
||||
set(XLNT_MAN_DEST_DIR ${CMAKE_INSTALL_MANDIR}
|
||||
CACHE PATH "Default location to install runtime files")
|
||||
set(XLNT_CMAKE_CFG_DEST_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
||||
CACHE PATH "Default location to install CMake config files")
|
||||
|
||||
if(NOT STATIC)
|
||||
# Compile shared library
|
||||
add_library(xlnt SHARED
|
||||
|
@ -149,7 +163,7 @@ if(NOT STATIC)
|
|||
PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
INSTALL_NAME_DIR "${LIB_DEST_DIR}")
|
||||
INSTALL_NAME_DIR "${XLNT_LIB_DEST_DIR}")
|
||||
else()
|
||||
# Compile static library
|
||||
add_library(xlnt STATIC ${XLNT_HEADERS} ${XLNT_SOURCES} $<TARGET_OBJECTS:libstudxml>)
|
||||
|
@ -160,10 +174,14 @@ endif()
|
|||
#target_compile_features(xlnt PUBLIC cxx_std_${XLNT_CXX_LANG})
|
||||
|
||||
# Includes
|
||||
target_include_directories(xlnt PUBLIC ${XLNT_INCLUDE_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/utfcpp)
|
||||
target_include_directories(xlnt
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${XLNT_INCLUDE_DIR}>
|
||||
$<INSTALL_INTERFACE:${XLNT_INC_DEST_DIR}>
|
||||
PRIVATE
|
||||
${XLNT_SOURCE_DIR}
|
||||
${XLNT_SOURCE_DIR}/../third-party/libstudxml
|
||||
${XLNT_SOURCE_DIR}/../third-party/utfcpp)
|
||||
|
||||
# Platform- and file-specific settings, MSVC
|
||||
if(MSVC)
|
||||
|
@ -216,40 +234,43 @@ source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
|
|||
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
|
||||
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
|
||||
|
||||
if(NOT INC_DEST_DIR)
|
||||
# Default location to install include files
|
||||
set(INC_DEST_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
||||
endif()
|
||||
|
||||
if(NOT LIB_DEST_DIR)
|
||||
# Default location to install library files
|
||||
set(LIB_DEST_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
|
||||
if(NOT BIN_DEST_DIR)
|
||||
# Default location to install runtime files
|
||||
set(BIN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
|
||||
if(NOT MAN_DEST_DIR)
|
||||
# Default location to install runtime files
|
||||
set(MAN_DEST_DIR ${CMAKE_INSTALL_PREFIX}/share/man)
|
||||
endif()
|
||||
|
||||
# Install library
|
||||
install(TARGETS xlnt
|
||||
LIBRARY DESTINATION ${LIB_DEST_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||
RUNTIME DESTINATION ${BIN_DEST_DIR})
|
||||
install(TARGETS xlnt EXPORT XlntTargets
|
||||
LIBRARY DESTINATION ${XLNT_LIB_DEST_DIR}
|
||||
ARCHIVE DESTINATION ${XLNT_LIB_DEST_DIR}
|
||||
RUNTIME DESTINATION ${XLNT_BIN_DEST_DIR})
|
||||
|
||||
install(EXPORT XlntTargets
|
||||
FILE XlntTargets.cmake
|
||||
NAMESPACE xlnt::
|
||||
DESTINATION ${XLNT_CMAKE_CFG_DEST_DIR})
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(XLNT_INCLUDE_INSTALL_DIR ${XLNT_INC_DEST_DIR})
|
||||
|
||||
#See https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html
|
||||
configure_package_config_file(../cmake/XlntConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/XlntConfig.cmake
|
||||
INSTALL_DESTINATION ${XLNT_CMAKE_CFG_DEST_DIR}
|
||||
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 ${XLNT_CMAKE_CFG_DEST_DIR})
|
||||
|
||||
# Install include directory
|
||||
install(DIRECTORY ${XLNT_INCLUDE_DIR}/xlnt
|
||||
DESTINATION include
|
||||
DESTINATION ${XLNT_INC_DEST_DIR}
|
||||
PATTERN ".DS_Store" EXCLUDE)
|
||||
|
||||
# Install LICENSE.md
|
||||
install(FILES ${XLNT_ROOT_DIR}/docs/xlnt.3
|
||||
DESTINATION ${MAN_DEST_DIR}/man3)
|
||||
DESTINATION ${XLNT_MAN_DEST_DIR}/man3)
|
||||
|
||||
# Configure uninstall
|
||||
configure_file("${XLNT_ROOT_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
|
@ -263,8 +284,8 @@ add_custom_target(uninstall
|
|||
|
||||
if(NOT MSVC)
|
||||
# Set pkg-config variables
|
||||
set(PKG_CONFIG_LIBDIR ${LIB_DEST_DIR})
|
||||
set(PKG_CONFIG_INCLUDEDIR ${INC_DEST_DIR})
|
||||
set(PKG_CONFIG_LIBDIR ${XLNT_LIB_DEST_DIR})
|
||||
set(PKG_CONFIG_INCLUDEDIR ${XLNT_INC_DEST_DIR})
|
||||
set(PKG_CONFIG_LIBS "-L\${libdir} -lxlnt")
|
||||
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
|
||||
|
||||
|
@ -274,5 +295,5 @@ if(NOT MSVC)
|
|||
|
||||
# pkg-config install
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/xlnt.pc"
|
||||
DESTINATION ${LIB_DEST_DIR}/pkgconfig)
|
||||
DESTINATION ${XLNT_LIB_DEST_DIR}/pkgconfig)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue
Block a user