diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e0a241cc..c6ff029ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/CommonModules/TinyCommon.cmake b/cmake/CommonModules/TinyCommon.cmake index 818498bfd..d09c114e1 100644 --- a/cmake/CommonModules/TinyCommon.cmake +++ b/cmake/CommonModules/TinyCommon.cmake @@ -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 + # 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 # 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