|
@@ -9,6 +9,7 @@
|
|
|
#include "cmCustomCommandLines.h"
|
|
#include "cmCustomCommandLines.h"
|
|
|
#include "cmDuration.h"
|
|
#include "cmDuration.h"
|
|
|
#include "cmFilePathChecksum.h"
|
|
#include "cmFilePathChecksum.h"
|
|
|
|
|
+#include "cmGeneratorExpression.h"
|
|
|
#include "cmGeneratorTarget.h"
|
|
#include "cmGeneratorTarget.h"
|
|
|
#include "cmGlobalGenerator.h"
|
|
#include "cmGlobalGenerator.h"
|
|
|
#include "cmLinkItem.h"
|
|
#include "cmLinkItem.h"
|
|
@@ -398,8 +399,16 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Init uic specific settings
|
|
// Init uic specific settings
|
|
|
- if (this->Uic.Enabled && !InitUic()) {
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ if (this->Uic.Enabled) {
|
|
|
|
|
+ if (InitUic()) {
|
|
|
|
|
+ auto* uicTarget = makefile->FindTargetToUse(
|
|
|
|
|
+ GetQtExecutableTargetName(this->QtVersion, "uic"));
|
|
|
|
|
+ if (uicTarget != nullptr) {
|
|
|
|
|
+ this->AutogenTarget.DependTargets.insert(uicTarget);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Autogen target name
|
|
// Autogen target name
|
|
@@ -440,6 +449,12 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
|
|
this->AutogenTarget.DependOrigin =
|
|
this->AutogenTarget.DependOrigin =
|
|
|
this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
|
|
this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
|
|
|
|
|
|
|
|
|
|
+ auto* mocTarget = makefile->FindTargetToUse(
|
|
|
|
|
+ GetQtExecutableTargetName(this->QtVersion, "moc"));
|
|
|
|
|
+ if (mocTarget != nullptr) {
|
|
|
|
|
+ this->AutogenTarget.DependTargets.insert(mocTarget);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
std::string const deps =
|
|
std::string const deps =
|
|
|
this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
|
|
this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
|
|
|
if (!deps.empty()) {
|
|
if (!deps.empty()) {
|
|
@@ -1095,6 +1110,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
{
|
|
{
|
|
|
cmMakefile* makefile = this->Target->Target->GetMakefile();
|
|
cmMakefile* makefile = this->Target->Target->GetMakefile();
|
|
|
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
|
|
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
|
|
|
|
|
+ auto rccTargetName = GetQtExecutableTargetName(this->QtVersion, "rcc");
|
|
|
|
|
|
|
|
for (Qrc const& qrc : this->Rcc.Qrcs) {
|
|
for (Qrc const& qrc : this->Rcc.Qrcs) {
|
|
|
// Register info file as generated by CMake
|
|
// Register info file as generated by CMake
|
|
@@ -1105,6 +1121,11 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
std::vector<std::string> ccOutput;
|
|
std::vector<std::string> ccOutput;
|
|
|
ccOutput.push_back(qrc.RccFile);
|
|
ccOutput.push_back(qrc.RccFile);
|
|
|
|
|
|
|
|
|
|
+ std::vector<std::string> ccDepends;
|
|
|
|
|
+ // Add the .qrc and info file to the custom command dependencies
|
|
|
|
|
+ ccDepends.push_back(qrc.QrcFile);
|
|
|
|
|
+ ccDepends.push_back(qrc.InfoFile);
|
|
|
|
|
+
|
|
|
cmCustomCommandLines commandLines;
|
|
cmCustomCommandLines commandLines;
|
|
|
if (this->MultiConfig) {
|
|
if (this->MultiConfig) {
|
|
|
// Build for all configurations
|
|
// Build for all configurations
|
|
@@ -1140,15 +1161,12 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
ccName += "_";
|
|
ccName += "_";
|
|
|
ccName += qrc.PathChecksum;
|
|
ccName += qrc.PathChecksum;
|
|
|
}
|
|
}
|
|
|
- std::vector<std::string> ccDepends;
|
|
|
|
|
- // Add the .qrc and info file to the custom target dependencies
|
|
|
|
|
- ccDepends.push_back(qrc.QrcFile);
|
|
|
|
|
- ccDepends.push_back(qrc.InfoFile);
|
|
|
|
|
|
|
|
|
|
cmTarget* autoRccTarget = makefile->AddUtilityCommand(
|
|
cmTarget* autoRccTarget = makefile->AddUtilityCommand(
|
|
|
ccName, cmMakefile::TargetOrigin::Generator, true,
|
|
ccName, cmMakefile::TargetOrigin::Generator, true,
|
|
|
this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
|
|
this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
|
|
|
ccComment.c_str());
|
|
ccComment.c_str());
|
|
|
|
|
+
|
|
|
// Create autogen generator target
|
|
// Create autogen generator target
|
|
|
localGen->AddGeneratorTarget(
|
|
localGen->AddGeneratorTarget(
|
|
|
new cmGeneratorTarget(autoRccTarget, localGen));
|
|
new cmGeneratorTarget(autoRccTarget, localGen));
|
|
@@ -1157,6 +1175,9 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
if (!this->TargetsFolder.empty()) {
|
|
if (!this->TargetsFolder.empty()) {
|
|
|
autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
|
|
autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!rccTargetName.empty()) {
|
|
|
|
|
+ autoRccTarget->AddUtility(rccTargetName, makefile);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// Add autogen target to the origin target dependencies
|
|
// Add autogen target to the origin target dependencies
|
|
|
this->Target->Target->AddUtility(ccName, makefile);
|
|
this->Target->Target->AddUtility(ccName, makefile);
|
|
@@ -1169,16 +1190,15 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
// Create custom rcc command
|
|
// Create custom rcc command
|
|
|
{
|
|
{
|
|
|
std::vector<std::string> ccByproducts;
|
|
std::vector<std::string> ccByproducts;
|
|
|
- std::vector<std::string> ccDepends;
|
|
|
|
|
- // Add the .qrc and info file to the custom command dependencies
|
|
|
|
|
- ccDepends.push_back(qrc.QrcFile);
|
|
|
|
|
- ccDepends.push_back(qrc.InfoFile);
|
|
|
|
|
|
|
|
|
|
// Add the resource files to the dependencies
|
|
// Add the resource files to the dependencies
|
|
|
for (std::string const& fileName : qrc.Resources) {
|
|
for (std::string const& fileName : qrc.Resources) {
|
|
|
// Add resource file to the custom command dependencies
|
|
// Add resource file to the custom command dependencies
|
|
|
ccDepends.push_back(fileName);
|
|
ccDepends.push_back(fileName);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!rccTargetName.empty()) {
|
|
|
|
|
+ ccDepends.push_back(rccTargetName);
|
|
|
|
|
+ }
|
|
|
makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
|
|
makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
|
|
|
/*main_dependency*/ std::string(),
|
|
/*main_dependency*/ std::string(),
|
|
|
commandLines, ccComment.c_str(),
|
|
commandLines, ccComment.c_str(),
|
|
@@ -1421,21 +1441,36 @@ std::pair<bool, std::string> GetQtExecutable(
|
|
|
const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target,
|
|
const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target,
|
|
|
const std::string& executable, bool ignoreMissingTarget, std::string* output)
|
|
const std::string& executable, bool ignoreMissingTarget, std::string* output)
|
|
|
{
|
|
{
|
|
|
|
|
+ const std::string upperExecutable = cmSystemTools::UpperCase(executable);
|
|
|
|
|
+ std::string result =
|
|
|
|
|
+ target->Target->GetSafeProperty("AUTO" + upperExecutable + "_EXECUTABLE");
|
|
|
|
|
+ if (!result.empty()) {
|
|
|
|
|
+ cmListFileBacktrace lfbt = target->Target->GetMakefile()->GetBacktrace();
|
|
|
|
|
+ cmGeneratorExpression ge(lfbt);
|
|
|
|
|
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(result);
|
|
|
|
|
+ result = cge->Evaluate(target->GetLocalGenerator(), "");
|
|
|
|
|
+
|
|
|
|
|
+ return std::make_pair(true, result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
std::string err;
|
|
std::string err;
|
|
|
- std::string result;
|
|
|
|
|
|
|
|
|
|
// Find executable
|
|
// Find executable
|
|
|
{
|
|
{
|
|
|
const std::string targetName =
|
|
const std::string targetName =
|
|
|
GetQtExecutableTargetName(qtVersion, executable);
|
|
GetQtExecutableTargetName(qtVersion, executable);
|
|
|
if (targetName.empty()) {
|
|
if (targetName.empty()) {
|
|
|
- err = "The AUTOMOC, AUTOUIC and AUTORCC feature ";
|
|
|
|
|
|
|
+ err = "The AUTO" + upperExecutable + " feature ";
|
|
|
err += "supports only Qt 4, Qt 5 and Qt 6.";
|
|
err += "supports only Qt 4, Qt 5 and Qt 6.";
|
|
|
} else {
|
|
} else {
|
|
|
cmLocalGenerator* localGen = target->GetLocalGenerator();
|
|
cmLocalGenerator* localGen = target->GetLocalGenerator();
|
|
|
cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
|
|
cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
|
|
|
if (tgt != nullptr) {
|
|
if (tgt != nullptr) {
|
|
|
- result = tgt->ImportedGetLocation("");
|
|
|
|
|
|
|
+ if (tgt->IsImported()) {
|
|
|
|
|
+ result = tgt->ImportedGetLocation("");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result = tgt->GetLocation("");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
if (ignoreMissingTarget) {
|
|
if (ignoreMissingTarget) {
|
|
|
return std::make_pair(true, "");
|
|
return std::make_pair(true, "");
|