diff options
author | Robert Adam <dev@robert-adam.de> | 2021-03-07 21:19:49 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-03-07 21:19:49 +0300 |
commit | bb252f6428d5c9678ae40af5e8bf641f32d09b69 (patch) | |
tree | 195af536f43a7b7bcab0cc8580b27bf307b65fc2 | |
parent | abc587235d8ce2ed7a6e6c25fa68082da1ae193a (diff) |
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.
-rw-r--r-- | cmake/qt-utils.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
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 <QtPlugin>\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() |