summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenGlobalInitializer.cxx
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2018-11-28 15:00:50 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-10 13:03:24 (GMT)
commitcd32886b2f5c8f6bdcc9185274a934102c821a20 (patch)
treec9126c0e11fb091ce504039a13d32bded1fc6466 /Source/cmQtAutoGenGlobalInitializer.cxx
parent9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3 (diff)
downloadCMake-cd32886b2f5c8f6bdcc9185274a934102c821a20.zip
CMake-cd32886b2f5c8f6bdcc9185274a934102c821a20.tar.gz
CMake-cd32886b2f5c8f6bdcc9185274a934102c821a20.tar.bz2
Autogen: Add AUTO(MOC|RCC|UIC)_EXECUTABLE target properties
Allow to force moc/rcc/uic compiler used for AUTO(MOC|RCC|UIC). Setting these properties is only necessary if you are going to do strange things like build these tools as part of your own build system. Setting these properties will also prevent cmake from testing the binary: It is user-provided and assumed to be valid.
Diffstat (limited to 'Source/cmQtAutoGenGlobalInitializer.cxx')
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 0ed8af4..678ff14 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -75,14 +75,26 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
bool const uic = target->GetPropertyAsBool("AUTOUIC");
bool const rcc = target->GetPropertyAsBool("AUTORCC");
if (moc || uic || rcc) {
- // We support Qt4 and Qt5
+ std::string const mocExec =
+ target->GetSafeProperty("AUTOMOC_EXECUTABLE");
+ std::string const uicExec =
+ target->GetSafeProperty("AUTOUIC_EXECUTABLE");
+ std::string const rccExec =
+ target->GetSafeProperty("AUTORCC_EXECUTABLE");
+
+ // We support Qt4, Qt5 and Qt6
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
- if ((qtVersion.Major == 4) || (qtVersion.Major == 5) ||
- (qtVersion.Major == 6)) {
+ bool const validQt = (qtVersion.Major == 4) ||
+ (qtVersion.Major == 5) || (qtVersion.Major == 6);
+ bool const mocIsValid = moc && (validQt || !mocExec.empty());
+ bool const uicIsValid = uic && (validQt || !uicExec.empty());
+ bool const rccIsValid = rcc && (validQt || !rccExec.empty());
+
+ if (mocIsValid || uicIsValid || rccIsValid) {
// Create autogen target initializer
Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(
- this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget,
- globalAutoRccTarget));
+ this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid,
+ globalAutoGenTarget, globalAutoRccTarget));
}
}
}