summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenGlobalInitializer.cxx
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-04-20 19:17:50 (GMT)
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-04-23 08:49:07 (GMT)
commit5b0ea5874a3322e57156b329b340bf283673c207 (patch)
treeee25d305166e04e92251c847bf502846b69780e4 /Source/cmQtAutoGenGlobalInitializer.cxx
parent63ffe210365ce2d1dd67fcabcc67e20913f320a8 (diff)
downloadCMake-5b0ea5874a3322e57156b329b340bf283673c207.zip
CMake-5b0ea5874a3322e57156b329b340bf283673c207.tar.gz
CMake-5b0ea5874a3322e57156b329b340bf283673c207.tar.bz2
AutoGen: Retrieve Qt version from moc as fallback
Consider the case where the find_package call for QtCore is wrapped in a function call. Then AutoGen cannot determine the Qt version, because it only looks at variables and directory properties. The former don't leave the function scope and the latter are not set by default. As a fallback, locate the moc executable via its target and call it with the --version argument to determine the Qt version. Issue: #22028
Diffstat (limited to 'Source/cmQtAutoGenGlobalInitializer.cxx')
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index f79ffd4..5896bb2 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -114,7 +114,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
target->GetSafeProperty(this->kw().AUTORCC_EXECUTABLE);
// We support Qt4, Qt5 and Qt6
- auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target.get());
+ auto qtVersion =
+ cmQtAutoGenInitializer::GetQtVersion(target.get(), mocExec);
bool const validQt = (qtVersion.first.Major == 4) ||
(qtVersion.first.Major == 5) || (qtVersion.first.Major == 6);