From bb252f6428d5c9678ae40af5e8bf641f32d09b69 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sun, 7 Mar 2021 19:19:49 +0100 Subject: BUILD(cmake): Fix unity build failure If the *_plugin_import.cpp files already exist before the latest cmake changes for unity builds are pulled, the necessary property does not get set on these files, which can cause build failure. --- cmake/qt-utils.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/qt-utils.cmake b/cmake/qt-utils.cmake index b1a15fd5e..c8ed212c3 100644 --- a/cmake/qt-utils.cmake +++ b/cmake/qt-utils.cmake @@ -8,7 +8,6 @@ function(include_qt_plugin TARGET SCOPE PLUGIN) if(NOT EXISTS ${PATH}) file(WRITE ${PATH} "#include \n") set_property(SOURCE ${PATH} PROPERTY GENERATED TRUE SKIP_AUTOGEN TRUE) - set_property(SOURCE ${PATH} PROPERTY SKIP_UNITY_BUILD_INCLUSION TRUE) else() file(READ ${PATH} CONTENT) string(FIND ${CONTENT} ${PLUGIN} INDEX) @@ -17,6 +16,13 @@ function(include_qt_plugin TARGET SCOPE PLUGIN) endif() endif() + # We have to exclude these files from unity builds since we have one of that for the client + # and one for the server. If they happen to get included in the same build or just with some + # other code that happens to include one of the plugins statically, then there'll be errors. + # We set the property on existing files as well in order to ensure that it is set even + # if the file existed already (and setting the property multiple times should not hurt). + set_property(SOURCE ${PATH} PROPERTY SKIP_UNITY_BUILD_INCLUSION TRUE) + if(NOT FOUND) file(APPEND ${PATH} "Q_IMPORT_PLUGIN(${PLUGIN})\n") endif() -- cgit v1.2.3