CMake: Fix failing plugin tests on MinGW

MinGW plugins should not have the lib prefix in the shared library
names. Do this manually for a couple of libraries, and also for the
generic qt_add_cmake_library function.

Amends 9b0e23ef8a

Change-Id: I1cfaf8fc046f86edd3e755adfa599aa0aa854ee3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-06-08 18:21:18 +02:00 committed by Alexandru Croitor
parent 85c1009dbb
commit db1de48291
4 changed files with 23 additions and 0 deletions

View File

@ -3895,6 +3895,10 @@ function(qt_add_cmake_library target)
# but Qt plugins are actually suffixed with .dylib.
set_property(TARGET "${target}" PROPERTY SUFFIX ".dylib")
endif()
if(WIN32)
# CMake sets for Windows-GNU platforms the suffix "lib"
set_property(TARGET "${target}" PROPERTY PREFIX "")
endif()
else()
add_library("${target}")
endif()

View File

@ -21,6 +21,12 @@ set_target_properties(mylib PROPERTIES
C_VISIBILITY_PRESET "default"
CXX_VISIBILITY_PRESET "default"
)
if(WIN32)
# CMake sets for Windows-GNU platforms the suffix "lib"
set_property(TARGET mylib PROPERTY PREFIX "")
endif()
# special case end
#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:

View File

@ -33,6 +33,12 @@ set_target_properties(mylib2 PROPERTIES
C_VISIBILITY_PRESET "default"
CXX_VISIBILITY_PRESET "default"
)
if(WIN32)
# CMake sets for Windows-GNU platforms the suffix "lib"
set_property(TARGET mylib2 PROPERTY PREFIX "")
endif()
if (UNIX)
add_dependencies(mylib2 mylib)
add_custom_command(TARGET mylib2 POST_BUILD

View File

@ -14,6 +14,13 @@ add_cmake_library(tst_qpluginloaderlib
Qt::Core
)
# special case begin
if(WIN32)
# CMake sets for Windows-GNU platforms the suffix "lib"
set_property(TARGET tst_qpluginloaderlib PROPERTY PREFIX "")
endif()
# special case begin
#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
# INSTALLS = "target"
# TEMPLATE = "lib"