@@ -8,10 +8,10 @@ endif()
88
99if (TREMOTESF_QT6)
1010 set (TREMOTESF_QT_VERSION_MAJOR 6)
11- set (TREMOTESF_MINIMUM_QT_VERSION 6.6)
11+ set (TREMOTESF_MINIMUM_QT_VERSION 6.6.0 )
1212else ()
1313 set (TREMOTESF_QT_VERSION_MAJOR 5)
14- set (TREMOTESF_MINIMUM_QT_VERSION 5.15)
14+ set (TREMOTESF_MINIMUM_QT_VERSION 5.15.0 )
1515endif ()
1616
1717if (UNIX AND NOT APPLE )
@@ -32,6 +32,20 @@ if (MSVC AND (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY))
3232 endif ()
3333endif ()
3434
35+ function (append_qt_disable_deprecated_macro LIST_VAR)
36+ string (REPLACE "." ";" min_qt_version_components "${TREMOTESF_MINIMUM_QT_VERSION} " )
37+ list (GET min_qt_version_components 0 major)
38+ list (GET min_qt_version_components 1 minor)
39+ list (GET min_qt_version_components 2 patch)
40+ math (EXPR macro_value "(${major} <<16)|(${minor} <<8)|(${patch} )" OUTPUT_FORMAT HEXADECIMAL)
41+ if (TREMOTESF_QT6)
42+ list (APPEND "${LIST_VAR} " "QT_DISABLE_DEPRECATED_UP_TO=${macro_value} " )
43+ else ()
44+ list (APPEND "${LIST_VAR} " "QT_DISABLE_DEPRECATED_BEFORE=${macro_value} " )
45+ endif ()
46+ return (PROPAGATE "${LIST_VAR} " )
47+ endfunction ()
48+
3549function (set_common_options_on_targets)
3650 set (
3751 gcc_style_warnings
@@ -126,10 +140,15 @@ function(set_common_options_on_targets)
126140 set (
127141 common_compile_definitions
128142 QT_DEPRECATED_WARNINGS
129- QT_DISABLE_DEPRECATED_BEFORE=0x050e00
130143 QT_MESSAGELOGCONTEXT
131144 )
132145
146+ # QT_DISABLE_DEPRECATED_BEFORE can cause linker errors with static Qt
147+ get_target_property (qt_library_type Qt::Core TYPE )
148+ if (NOT (qt_library_type STREQUAL STATIC_LIBRARY))
149+ append_qt_disable_deprecated_macro(common_compile_definitions)
150+ endif ()
151+
133152 if (WIN32 )
134153 include ("${CMAKE_CURRENT_FUNCTION_LIST_DIR} /WindowsMinimumVersion.cmake" )
135154 # Minimum supported version, 0x0A00 = Windows 10
0 commit comments