1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-16 04:42:53 +08:00

Use already found Qt major verion

When including this project into other
project it might happen that find_package()
has already found a Qt version, so we
will use it if QT_MAJOR_VERSION was already
defined.

ISSUE: #258
This commit is contained in:
Daniel Nicoletti 2022-12-13 23:15:04 -03:00
parent 1e8de52879
commit 5b565bf260

View File

@ -13,7 +13,9 @@ set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED QT_VERSION_MAJOR)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
endif()
find_package(Qt${QT_VERSION_MAJOR} 5.9 COMPONENTS Core Gui REQUIRED)
set(EXPORT_NAME QXlsxQt${QT_VERSION_MAJOR})
@ -150,7 +152,7 @@ target_compile_definitions(QXlsx PRIVATE
QT_USE_QSTRINGBUILDER
QT_NO_SIGNALS_SLOTS_KEYWORDS
QT_USE_FAST_OPERATOR_PLUS
QT_DISABLE_DEPRECATED_BEFORE=0x050F00
QT_DISABLE_DEPRECATED_BEFORE=0x060200
)
if (NOT WIN32)