summarylogtreecommitdiffstats
path: root/0001-Use-CMake-s-default-import-library-suffix.patch
blob: a20ed75bcadbeb4d520a849e2079afaad6ba4b3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
From 650acfde27ba71b4ac9a8c8b589ca13457992729 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Thu, 5 Nov 2020 22:08:10 +0100
Subject: [PATCH 01/18] Use CMake's default import library suffix

Change-Id: I3dbedaec74683e5bfd008f7f2fd1e046dfb921b2
---
 cmake/QtPriHelpers.cmake          | 12 ++++++++++--
 cmake/QtPrlHelpers.cmake          |  8 +++++++-
 mkspecs/common/g++-win32.conf     |  1 +
 mkspecs/features/create_cmake.prf |  5 +++--
 src/corelib/Qt6CoreMacros.cmake   |  1 -
 5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake
index c3b13c7af4c..99a20799eca 100644
--- a/cmake/QtPriHelpers.cmake
+++ b/cmake/QtPriHelpers.cmake
@@ -521,9 +521,13 @@ QT.${config_module_name}_private.disabled_features = ${disabled_private_features
         qt_path_join(private_pri_file_path "${target_path}" "${private_pri_file_name}")
         list(APPEND pri_files "${private_pri_file_path}")
 
-        set(library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX} ${CMAKE_STATIC_LIBRARY_PREFIX})
+        set(library_prefixes
+            ${CMAKE_SHARED_LIBRARY_PREFIX}
+            ${CMAKE_IMPORT_LIBRARY_PREFIX}
+            ${CMAKE_STATIC_LIBRARY_PREFIX})
         set(library_suffixes
             ${CMAKE_SHARED_LIBRARY_SUFFIX}
+            ${CMAKE_CMAKE_IMPORT_LIBRARY_SUFFIX}
             ${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}
             ${CMAKE_STATIC_LIBRARY_SUFFIX})
         if(MSVC)
@@ -987,9 +991,13 @@ CONFIG += ${private_config_joined}
         list(APPEND inputs "${preliminary_pri_root}/${cfg}/${pri_data_cmake_file}")
     endforeach()
 
-    set(library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX} ${CMAKE_STATIC_LIBRARY_PREFIX})
+    set(library_prefixes
+        ${CMAKE_SHARED_LIBRARY_PREFIX}
+        ${CMAKE_IMPORT_LIBRARY_PREFIX}
+        ${CMAKE_STATIC_LIBRARY_PREFIX})
     set(library_suffixes
         ${CMAKE_SHARED_LIBRARY_SUFFIX}
+        ${CMAKE_CMAKE_IMPORT_LIBRARY_SUFFIX}
         ${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}
         ${CMAKE_STATIC_LIBRARY_SUFFIX})
     if(MSVC)
diff --git a/cmake/QtPrlHelpers.cmake b/cmake/QtPrlHelpers.cmake
index 45bfaedcdf6..a433c98fe8c 100644
--- a/cmake/QtPrlHelpers.cmake
+++ b/cmake/QtPrlHelpers.cmake
@@ -123,11 +123,17 @@ ${prl_step1_content_libs}
          CONTENT
          "FINAL_PRL_FILE_PATH = ${final_prl_file_path}")
 
-    set(library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX} ${CMAKE_STATIC_LIBRARY_PREFIX})
+    set(library_prefixes
+        ${CMAKE_SHARED_LIBRARY_PREFIX}
+        ${CMAKE_IMPORT_LIBRARY_PREFIX}
+        ${CMAKE_STATIC_LIBRARY_PREFIX})
     set(library_suffixes
         ${CMAKE_SHARED_LIBRARY_SUFFIX}
+        ${CMAKE_CMAKE_IMPORT_LIBRARY_SUFFIX}
         ${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}
         ${CMAKE_STATIC_LIBRARY_SUFFIX})
+    list(REMOVE_DUPLICATES library_prefixes)
+    list(REMOVE_DUPLICATES library_suffixes)
 
     if(QT_GENERATOR_IS_MULTI_CONFIG)
         set(configs ${CMAKE_CONFIGURATION_TYPES})
diff --git a/mkspecs/common/g++-win32.conf b/mkspecs/common/g++-win32.conf
index 67ad1e3b8c1..b98c7121f6f 100644
--- a/mkspecs/common/g++-win32.conf
+++ b/mkspecs/common/g++-win32.conf
@@ -54,6 +54,7 @@ QMAKE_PREFIX_SHLIB      =
 QMAKE_EXTENSION_SHLIB   = dll
 QMAKE_PREFIX_STATICLIB  = lib
 QMAKE_EXTENSION_STATICLIB = a
+QMAKE_EXTENSION_IMPORTLIB = dll.a
 QMAKE_LIB_EXTENSIONS    = a dll.a
 
 QMAKE_LIBS              =
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 24ed125f12b..73ebe453d3d 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -332,8 +332,9 @@ mac {
         CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}$${debug_suffix}.a
         CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
 
-        CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}$${debug_suffix}.a
-        CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
+        isEmpty(QMAKE_EXTENSION_IMPORTLIB): QMAKE_EXTENSION_IMPORTLIB = a
+        CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}$${debug_suffix}.$${QMAKE_EXTENSION_IMPORTLIB}
+        CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$${QMAKE_EXTENSION_IMPORTLIB}
     } else {
         CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}$${debug_suffix}.lib
         CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index d922f9bd251..10074456932 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -617,7 +617,6 @@ function(_qt_internal_apply_win_prefix_and_suffix target)
 
         # This should cover both MINGW with GCC and CLANG.
         if(NOT MSVC)
-            set_property(TARGET "${target}" PROPERTY IMPORT_SUFFIX ".a")
 
             get_target_property(target_type ${target} TYPE)
             if(target_type STREQUAL "STATIC_LIBRARY")
-- 
2.47.0