1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00
QXlsx/CMakeLists.txt
Samuel Bryner fb2449503d Allow library to be used with add_subdirectory() in cmake.
Use ${PROJECT_*_DIR}, which is relative to the current project() instead
of ${CMAKE_*_DIR} which is relative to the top-level CMakeLists.txt
2020-07-15 15:59:03 +02:00

46 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(QXlsx VERSION 1.0.0 LANGUAGES CXX)
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core Gui)
find_package(Qt5Gui CONFIG REQUIRED Private)
set(CMAKE_AUTOMOC ON)
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
)
#------------------------------------------------------------------------------
# Library
#------------------------------------------------------------------------------
add_library(QXlsx)
#------------------------------------------------------------------------------
# Target
#------------------------------------------------------------------------------
# Define target sources
file(GLOB_RECURSE files ${PROJECT_SOURCE_DIR}/QXlsx/source/*.cpp ${PROJECT_SOURCE_DIR}/QXlsx/header/*.h)
target_sources(QXlsx PRIVATE
${files}
)
target_link_libraries(QXlsx PUBLIC Qt5::Core Qt5::Gui Qt5::GuiPrivate)
target_include_directories(QXlsx PUBLIC ${PROJECT_SOURCE_DIR}/QXlsx/header)
configure_file(
${PROJECT_SOURCE_DIR}/CMake/QXlsxConfig.cmake.in
"${PROJECT_BINARY_DIR}/QXlsxConfig.cmake" @ONLY)
export(TARGETS QXlsx
FILE "${PROJECT_BINARY_DIR}/QXlsxTargets.cmake")