2020-03-23 15:57:36 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2020-09-28 02:17:38 +01:00
|
|
|
project(QXlsx VERSION 1.3.56 LANGUAGES CXX)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
2020-03-23 15:57:36 +01:00
|
|
|
|
2020-05-22 14:38:18 -03:00
|
|
|
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core Gui)
|
2020-03-23 15:57:36 +01:00
|
|
|
find_package(Qt5Gui CONFIG REQUIRED Private)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
2020-05-22 14:38:18 -03:00
|
|
|
add_definitions(
|
|
|
|
-DQT_NO_KEYWORDS
|
|
|
|
-DQT_NO_CAST_TO_ASCII
|
|
|
|
-DQT_NO_CAST_FROM_ASCII
|
|
|
|
-DQT_STRICT_ITERATORS
|
|
|
|
-DQT_NO_URL_CAST_FROM_STRING
|
|
|
|
-DQT_NO_CAST_FROM_BYTEARRAY
|
|
|
|
-DQT_USE_QSTRINGBUILDER
|
|
|
|
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
|
|
|
|
-DQT_USE_FAST_OPERATOR_PLUS
|
|
|
|
-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00
|
|
|
|
)
|
|
|
|
|
2020-03-23 15:57:36 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Library
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
add_library(QXlsx)
|
2020-09-28 02:17:38 +01:00
|
|
|
set_target_properties(QXlsx PROPERTIES
|
|
|
|
SOVERSION ${PROJECT_VERSION})
|
2020-03-23 15:57:36 +01:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Target
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Define target sources
|
2020-09-28 02:17:38 +01:00
|
|
|
file(GLOB_RECURSE files_cpp ${PROJECT_SOURCE_DIR}/QXlsx/source/*.cpp)
|
|
|
|
file(GLOB_RECURSE files_h ${PROJECT_SOURCE_DIR}/QXlsx/header/*.h)
|
2020-03-23 15:57:36 +01:00
|
|
|
|
|
|
|
target_sources(QXlsx PRIVATE
|
2020-09-28 02:17:38 +01:00
|
|
|
${files_cpp} ${files_h}
|
2020-03-23 15:57:36 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(QXlsx PUBLIC Qt5::Core Qt5::Gui Qt5::GuiPrivate)
|
2020-09-28 02:17:38 +01:00
|
|
|
target_include_directories(QXlsx
|
|
|
|
PRIVATE ${PROJECT_SOURCE_DIR}/QXlsx/header
|
|
|
|
INTERFACE ${CMAKE_INSTALL_FULL_INCLUDEDIR}/QXlsx)
|
2020-03-23 15:57:36 +01:00
|
|
|
|
|
|
|
configure_file(
|
2020-07-15 15:59:03 +02:00
|
|
|
${PROJECT_SOURCE_DIR}/CMake/QXlsxConfig.cmake.in
|
|
|
|
"${PROJECT_BINARY_DIR}/QXlsxConfig.cmake" @ONLY)
|
2020-03-23 15:57:36 +01:00
|
|
|
|
|
|
|
export(TARGETS QXlsx
|
2020-07-15 15:59:03 +02:00
|
|
|
FILE "${PROJECT_BINARY_DIR}/QXlsxTargets.cmake")
|
2020-09-28 02:17:38 +01:00
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(${PROJECT_BINARY_DIR}/QXlsxConfigVersion.cmake
|
|
|
|
COMPATIBILITY AnyNewerVersion)
|
|
|
|
install(TARGETS QXlsx EXPORT QXlsxTargets)
|
|
|
|
install(FILES
|
|
|
|
${PROJECT_BINARY_DIR}/QXlsxConfig.cmake
|
|
|
|
${PROJECT_BINARY_DIR}/QXlsxConfigVersion.cmake
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/QXlsx/cmake)
|
|
|
|
install(EXPORT QXlsxTargets DESTINATION ${CMAKE_INSTALL_DATADIR}/QXlsx/cmake)
|
|
|
|
install(FILES ${files_h} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsx)
|