cmake bugfix MSYS2 Qt 6

This commit is contained in:
silverqx
2023-01-15 13:45:13 +01:00
parent 11ab1a7ec9
commit e775e81995
2 changed files with 22 additions and 9 deletions

View File

@@ -337,6 +337,15 @@ tiny_resource_and_manifest(${TinyOrm_target}
# Resolve and link dependencies
# ---
# Must be before the TinyCommon, to exclude WINVER for the MSYS2 Qt6 builds to avoid:
# 'WINVER' macro redefined [-Wmacro-redefined]
# Look also to the TinyCommon for conditional WINVER definition
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core Sql)
tiny_find_package(Qt${QT_VERSION_MAJOR} ${minQtVersion} CONFIG
REQUIRED COMPONENTS Core Sql
)
tiny_find_package(range-v3 CONFIG REQUIRED)
# Common configuration as interface library
include(TinyCommon)
tiny_common(${CommonConfig_target}
@@ -345,12 +354,6 @@ tiny_common(${CommonConfig_target}
)
# Unconditional dependencies
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core Sql)
tiny_find_package(Qt${QT_VERSION_MAJOR} ${minQtVersion} CONFIG
REQUIRED COMPONENTS Core Sql
)
tiny_find_package(range-v3 CONFIG REQUIRED)
target_link_libraries(${TinyOrm_target}
PUBLIC
Qt${QT_VERSION_MAJOR}::Core

View File

@@ -46,12 +46,22 @@ ${TINY_UNPARSED_ARGUMENTS}")
# ---
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# All have to be defined because of checks at the beginning of <qt_windows.h>
# WINVER, _WIN32_WINNT, NTDDI_VERSION
# MSYS2 Qt 6 already defines these macros in the Qt6Targets.cmake Qt6::Platform
# Flipped expression of : if(MINGW AND QT_VERSION_MAJOR GREATER_EQUAL 6)
if(NOT MINGW OR NOT QT_VERSION_MAJOR GREATER_EQUAL 6)
target_compile_definitions(${target} INTERFACE
# Windows 10 1903 "19H1" - 0x0A000007
WINVER=_WIN32_WINNT_WIN10
_WIN32_WINNT=_WIN32_WINNT_WIN10
)
endif()
target_compile_definitions(${target} INTERFACE
# All have to be defined because of checks at the beginning of <qt_windows.h>
# Windows 10 1903 "19H1" - 0x0A000007
WINVER=_WIN32_WINNT_WIN10
NTDDI_VERSION=NTDDI_WIN10_19H1
_WIN32_WINNT=_WIN32_WINNT_WIN10
# Internet Explorer 11
_WIN32_IE=_WIN32_IE_IE110
UNICODE _UNICODE