summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-10-23 14:45:20 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-10-28 09:20:37 +0000
commit69fb4ae343777af9078e5128ec41cfb3cea2cd76 (patch)
tree7d15b4dde18289f583dc195f121556b04dd85e55
parent080f9ad160ef7422b2bab884c7ccc950d35b3a0a (diff)
Distinguish between qt_plugin and regular plugins
If we do not encounter the load(qt_plugin) statement in the .pro file but we do see the entry CONFIG+=plugin, treat the target as a regular CMake library instead of treating it as a qt_plugin by default. Change-Id: I67ad5c865a1a5ab691a6b0d86c2db4b686aa04dd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtBuild.cmake4
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt41
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt22
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt34
-rw-r--r--tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt8
-rw-r--r--tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt8
-rw-r--r--tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt8
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt30
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt34
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt23
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt44
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt6
-rw-r--r--tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt29
-rwxr-xr-xutil/cmake/pro2cmake.py22
19 files changed, 312 insertions, 39 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 4c2c1e69b8..ade0c05328 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -2584,6 +2584,10 @@ function(add_cmake_library target)
add_library("${target}" STATIC)
elseif(${arg_SHARED})
add_library("${target}" SHARED)
+ elseif(${arg_MODULE})
+ add_library("${target}" MODULE)
+ set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default)
+ set_property(TARGET ${name} PROPERTY CXX_VISIBILITY_PRESET default)
else()
add_library("${target}")
endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
index 56a126c78b..940dcc2b09 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
@@ -1,10 +1,11 @@
# Generated from plugin1.pro.
#####################################################################
-## plugin1 Plugin:
+## plugin1 Generic Library:
#####################################################################
-add_qt_plugin(plugin1
+add_cmake_library(plugin1
+ MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
SOURCES
@@ -31,3 +32,5 @@ extend_target(plugin1 CONDITION NOT QT_FEATURE_library
DEFINES
QT_STATICPLUGIN
)
+
+qt_autogen_tools_initial_setup(plugin1)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
index 5b6e9062cc..2df999c292 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
@@ -1,10 +1,11 @@
# Generated from plugin2.pro.
#####################################################################
-## plugin2 Plugin:
+## plugin2 Generic Library:
#####################################################################
-add_qt_plugin(plugin2
+add_cmake_library(plugin2
+ MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
SOURCES
@@ -31,3 +32,5 @@ extend_target(plugin2 CONDITION NOT QT_FEATURE_library
DEFINES
QT_STATICPLUGIN
)
+
+qt_autogen_tools_initial_setup(plugin2)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..554d51292f
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qfactoryloader Test:
+#####################################################################
+
+add_qt_test(tst_qfactoryloader
+ SOURCES
+ ../plugin1/plugininterface1.h
+ ../plugin2/plugininterface2.h
+ ../tst_qfactoryloader.cpp
+ LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qfactoryloader CONDITION NOT QT_FEATURE_library
+ PUBLIC_LIBRARIES
+ # Remove: L
+ ../bin/
+ plugin1
+ plugin2
+)
+
+if(ANDROID)
+ # Resources:
+ set(qmake_libs_resource_files
+ ${CMAKE_CURRENT_BINARY_DIR}/../bin
+ )
+
+ add_qt_resource(tst_qfactoryloader "qmake_libs"
+ PREFIX
+ "android_test_data"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/.."
+ FILES
+ ${qmake_libs_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
index 7d81342b4a..c721aa3a5a 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
@@ -30,8 +30,6 @@ extend_target(tst_qfactoryloader CONDITION NOT QT_FEATURE_library
# this part is handled as a special case above
# ../bin/
# special case end
- plugin1
- plugin2
)
if(ANDROID)
@@ -45,15 +43,19 @@ if(ANDROID)
${CMAKE_CURRENT_BINARY_DIR}/../bin/libplugin2.so
PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY plugin2
)
- # special case end
# Resources:
- set(qmake_libs_resource_files
- # special case begin
- bin/libplugin1.so
- bin/libplugin2.so
- #${CMAKE_CURRENT_BINARY_DIR}/../bin
- # special case end
- )
+ if (ANDROID)
+ set(qmake_libs_resource_files
+ bin/libplugin1_${CMAKE_ANDROID_ARCH_ABI}.so
+ bin/libplugin2_${CMAKE_ANDROID_ARCH_ABI}.so
+ )
+ else()
+ set(qmake_libs_resource_files
+ bin/libplugin1.so
+ bin/libplugin2.so
+ )
+ endif()
+ # special case end
add_qt_resource(tst_qfactoryloader "qmake_libs"
PREFIX
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..6dbbd7a060
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from lib.pro.
+
+#####################################################################
+## mylib Generic Library:
+#####################################################################
+
+add_cmake_library(mylib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qlibrary"
+
+## Scopes:
+#####################################################################
+
+extend_target(mylib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
+
+#### Keys ignored in scope 4:.:.:lib.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/"
+
+#### Keys ignored in scope 5:.:.:lib.pro:else:
+# DESTDIR = "../release/"
diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt
index 5b9a21cb3b..ab32e5e364 100644
--- a/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from debugplugin.pro.
#####################################################################
-## debugplugin Plugin:
+## debugplugin Generic Library:
#####################################################################
-add_qt_plugin(debugplugin
- SKIP_INSTALL
+add_cmake_library(debugplugin
+ MODULE
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
SOURCES
main.cpp
@@ -15,3 +15,5 @@ add_qt_plugin(debugplugin
#### Keys ignored in scope 1:.:.:debugplugin.pro:<TRUE>:
# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(debugplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt
index e053008d54..c3eb37d930 100644
--- a/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from invalidplugin.pro.
#####################################################################
-## invalidplugin Plugin:
+## invalidplugin Generic Library:
#####################################################################
-add_qt_plugin(invalidplugin
- SKIP_INSTALL
+add_cmake_library(invalidplugin
+ MODULE
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
SOURCES
main.cpp
@@ -15,3 +15,5 @@ add_qt_plugin(invalidplugin
#### Keys ignored in scope 1:.:.:invalidplugin.pro:<TRUE>:
# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(invalidplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt
index cb09cb4207..893386bc6b 100644
--- a/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from releaseplugin.pro.
#####################################################################
-## releaseplugin Plugin:
+## releaseplugin Generic Library:
#####################################################################
-add_qt_plugin(releaseplugin
- SKIP_INSTALL
+add_cmake_library(releaseplugin
+ MODULE
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
SOURCES
main.cpp
@@ -15,3 +15,5 @@ add_qt_plugin(releaseplugin
#### Keys ignored in scope 1:.:.:releaseplugin.pro:<TRUE>:
# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(releaseplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..5e42a1aef0
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt
@@ -0,0 +1,30 @@
+# Generated from almostplugin.pro.
+
+#####################################################################
+## almostplugin Generic Library:
+#####################################################################
+
+add_cmake_library(almostplugin
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ almostplugin.cpp almostplugin.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:almostplugin.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+extend_target(almostplugin CONDITION GCC
+ LINK_OPTIONS
+ "--Wl,--no-undefined"
+)
+
+qt_autogen_tools_initial_setup(almostplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt
index 62653e1a65..5208a70c9d 100644
--- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generated from almostplugin.pro.
#####################################################################
-## almostplugin Plugin:
+## almostplugin Generic Library:
#####################################################################
-add_qt_plugin(almostplugin
- ALLOW_UNDEFINED_SYMBOLS # special case
+add_cmake_library(almostplugin
+ MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
SOURCES
@@ -22,6 +22,7 @@ add_qt_plugin(almostplugin
## Scopes:
#####################################################################
+qt_autogen_tools_initial_setup(almostplugin)
# special case begin
# We want the opposite of this
#extend_target(almostplugin CONDITION GCC
diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..74945fc6d8
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from lib.pro.
+
+#####################################################################
+## tst_qpluginloaderlib Generic Library:
+#####################################################################
+
+add_cmake_library(tst_qpluginloaderlib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 7:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+extend_target(tst_qpluginloaderlib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..bfc30d7c1d
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt
@@ -0,0 +1,23 @@
+# Generated from staticplugin.pro.
+
+#####################################################################
+## staticplugin Generic Library:
+#####################################################################
+
+add_cmake_library(staticplugin
+ STATIC
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ MOC_OPTIONS
+ "-M"
+ "ExtraMetaData=StaticPlugin"
+ "-M"
+ "ExtraMetaData=foo"
+)
+
+#### Keys ignored in scope 1:.:.:staticplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(staticplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
index b29ef3f982..fb9d365d74 100644
--- a/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
@@ -1,12 +1,10 @@
# Generated from staticplugin.pro.
#####################################################################
-## staticplugin Plugin:
+## staticplugin Generic Library:
#####################################################################
-add_qt_plugin(staticplugin
- OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case
- SKIP_INSTALL
+add_cmake_library(staticplugin
STATIC
SOURCES
main.cpp
@@ -21,3 +19,7 @@ add_qt_plugin(staticplugin
#### Keys ignored in scope 1:.:.:staticplugin.pro:<TRUE>:
# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(staticplugin)
+
+target_compile_definitions(staticplugin PRIVATE QT_STATICPLUGIN)
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
index 3eb62d511a..5389790fba 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
@@ -1,10 +1,11 @@
# Generated from theplugin.pro.
#####################################################################
-## theplugin Plugin:
+## theplugin Generic Library:
#####################################################################
-add_qt_plugin(theplugin
+add_cmake_library(theplugin
+ MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
SOURCES
@@ -26,3 +27,5 @@ add_qt_plugin(theplugin
#### Keys ignored in scope 6:.:..:../winrt.pri:else:
# DESTDIR = "../release/bin"
+
+qt_autogen_tools_initial_setup(theplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..cf63ce61c9
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt
@@ -0,0 +1,44 @@
+# Generated from tst.pro.
+
+#####################################################################
+## tst_qpluginloader Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../elftest")
+list(APPEND test_data "../machtest")
+
+add_qt_test(tst_qpluginloader
+ SOURCES
+ ../fakeplugin.cpp
+ ../theplugin/plugininterface.h
+ ../tst_qpluginloader.cpp
+ PUBLIC_LIBRARIES
+ staticplugin
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32 AND debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/debug
+)
+
+extend_target(tst_qpluginloader CONDITION WIN32 AND debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/release
+)
+
+extend_target(tst_qpluginloader CONDITION UNIX OR NOT debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin
+)
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
index c456eae4ba..85ed763949 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
@@ -29,17 +29,17 @@ extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
Qt::Core
)
-extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32
+extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32 AND debug_and_release
PUBLIC_LIBRARIES
# Remove: L../staticplugin/debug
)
-extend_target(tst_qpluginloader CONDITION WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL Debug
+extend_target(tst_qpluginloader CONDITION WIN32 AND debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug
PUBLIC_LIBRARIES
# Remove: L../staticplugin/release
)
-extend_target(tst_qpluginloader CONDITION UNIX
+extend_target(tst_qpluginloader CONDITION UNIX OR NOT debug_and_release
PUBLIC_LIBRARIES
# Remove: L../staticplugin
)
diff --git a/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..c635f6479c
--- /dev/null
+++ b/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_quuid Test:
+#####################################################################
+
+add_qt_test(tst_quuid
+ SOURCES
+ ../tst_quuid.cpp
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_quuid CONDITION APPLE
+ SOURCES
+ ../tst_quuid_darwin.mm
+ PUBLIC_LIBRARIES
+ ${FWFoundation}
+)
+
+#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug"
+
+#### Keys ignored in scope 5:.:.:test.pro:else:
+# DESTDIR = "../release"
+
+#### Keys ignored in scope 6:.:.:test.pro:else:
+# DESTDIR = ".."
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 36e899d781..100e81e2c5 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -2498,6 +2498,12 @@ def write_generic_library(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> s
if "dll" in scope.get("CONFIG"):
library_type = "SHARED"
+ is_plugin = False
+ if "plugin" in scope.get("CONFIG"):
+ library_type = "MODULE"
+ is_plugin = True
+
+ # static after plugin in order to handle static library plugins
if "static" in scope.get("CONFIG"):
library_type = "STATIC"
@@ -2523,6 +2529,13 @@ def write_generic_library(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> s
extra_keys=[],
)
+ if is_plugin:
+ # Plugins need to be able to run auto moc
+ cm_fh.write(f"\nqt_autogen_tools_initial_setup({target_name})\n")
+
+ if library_type == "STATIC":
+ cm_fh.write(f"\ntarget_compile_definitions({target_name} PRIVATE QT_STATICPLUGIN)\n")
+
return target_name
@@ -3077,8 +3090,9 @@ def handle_app_or_lib(
is_jar = "java" in config
is_lib = scope.TEMPLATE == "lib"
is_qml_plugin = any("qml_plugin" == s for s in scope.get("_LOADED"))
- is_plugin = (
- any("qt_plugin" == s for s in scope.get("_LOADED")) or is_qml_plugin or "plugin" in config
+ is_plugin = "plugin" in config
+ is_qt_plugin = (
+ any("qt_plugin" == s for s in scope.get("_LOADED")) or is_qml_plugin
)
target = ""
gui = all(
@@ -3089,10 +3103,10 @@ def handle_app_or_lib(
tar = write_jar(cm_fh, scope, indent=indent)
elif is_example:
target = write_example(cm_fh, scope, gui, indent=indent, is_plugin=is_plugin)
- elif is_plugin:
+ elif is_qt_plugin:
assert not is_example
target = write_plugin(cm_fh, scope, indent=indent)
- elif is_lib and "qt_module" not in scope.get("_LOADED"):
+ elif (is_lib and "qt_module" not in scope.get("_LOADED")) or is_plugin:
assert not is_example
target = write_generic_library(cm_fh, scope, indent=indent)
elif is_lib or "qt_module" in scope.get("_LOADED"):