summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-17 12:31:40 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-17 15:13:44 +0200
commite67829e6556300f1ec281d635a12fae188ca55d0 (patch)
treef42b4dc71af63d04e31b265f394685e09ebda81e /cmake
parent9862cb45328e28d06975b0245e23ef5499fc282b (diff)
CMake: Fix MinGW prefixes / suffixes again
Document what qmake expects and what CMake creates by default. This change should fix qmake mixing for MinGW, where the WinMain library was called qtmain.a instead of libqtmain.a. Amends f626c73b28b52ecf3a3fb20592f2134337f89d35 and 9b0e23ef8a915a8c58808fa356f771ecdb6f020c Task-number: QTBUG-84781 Change-Id: I059db13f8d8a0aab8bd3fc69d4537a2b63687394 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake35
1 files changed, 29 insertions, 6 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 46442b9e96..c9c667f35c 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -5520,14 +5520,37 @@ endfunction()
function(qt_internal_apply_win_prefix_and_suffix target)
if(WIN32)
- # CMake sets for Windows-GNU platforms the prefix "lib", whereas qmake expects
- # no prefix.
- set_property(TARGET "${target}" PROPERTY PREFIX "")
+ # Table of prefix / suffixes for MSVC libraries as qmake expects them to be created.
+ # static - Qt6EdidSupport.lib (platform support libraries / or static QtCore, etc)
+ # shared - Qt6Core.dll
+ # shared import library - Qt6Core.lib
+ # module aka Qt plugin - qwindows.dll
+ # module import library - qwindows.lib
+ #
+ # The CMake defaults are fine for us.
+
+ # Table of prefix / suffixes for MinGW libraries as qmake expects them to be created.
+ # static - libQt6EdidSupport.a (platform support libraries / or static QtCore, etc)
+ # shared - Qt6Core.dll
+ # shared import library - libQt6Core.a
+ # module aka Qt plugin - qwindows.dll
+ # module import library - libqwindows.a
+ #
+ # CMake for Windows-GNU platforms defaults the prefix to "lib".
+ # CMake for Windows-GNU platforms defaults the import suffix to ".dll.a".
+ # These CMake defaults are not ok for us.
- # CMake sets for Windows-GNU platforms the import suffix "dll.a", whereas qmake
- # expects an ".a" import suffix.
- if(MINGW)
+ # 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")
+ set_property(TARGET "${target}" PROPERTY PREFIX "lib")
+ else()
+ set_property(TARGET "${target}" PROPERTY PREFIX "")
+ set_property(TARGET "${target}" PROPERTY IMPORT_PREFIX "lib")
+ endif()
endif()
endif()
endfunction()