summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-01 15:19:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-06-01 15:19:19 (GMT)
commitf6435f799ea7aa6669b035fee2a0559040890d27 (patch)
treebbbf240c1da7f73bf0ab4380fa814c5fb592bb7b /Source
parent99e80ea0ac2de2e0c24652c2af8589967996a0d4 (diff)
parent1f4b374d6e936960d902307bc9dcd4e8d93168e2 (diff)
downloadCMake-f6435f799ea7aa6669b035fee2a0559040890d27.zip
CMake-f6435f799ea7aa6669b035fee2a0559040890d27.tar.gz
CMake-f6435f799ea7aa6669b035fee2a0559040890d27.tar.bz2
Merge topic 'automoc-moc-options-test'
1f4b374d6e cmQtAutoGenInitializer: Reduce string copies b6f66b445a cmQtAutoGenInitializer: Remove no-op calls 55d93bdabf cmQtAutoGenInitializer: Improve const correctness feb56a666f cmTarget: Improve const correctness of AddUtility 5e513e562f Help: Add AUTOMOC_MOC_OPTIONS example 5380ad9d58 Tests: Add test for AUTOMOC_MOC_OPTIONS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8523
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx14
-rw-r--r--Source/cmTarget.cxx3
-rw-r--r--Source/cmTarget.h2
3 files changed, 8 insertions, 11 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 2c48e78..c9f65f6 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1381,29 +1381,25 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// '_autogen' target.
const auto timestampTargetName =
cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
- std::vector<std::string> timestampTargetProvides;
- cmCustomCommandLines timestampTargetCommandLines;
// Add additional autogen target dependencies to
// '_autogen_timestamp_deps'.
for (const cmTarget* t : this->AutogenTarget.DependTargets) {
std::string depname = t->GetName();
if (t->IsImported()) {
- auto ttype = t->GetType();
+ auto const ttype = t->GetType();
if (ttype == cmStateEnums::TargetType::STATIC_LIBRARY ||
ttype == cmStateEnums::TargetType::SHARED_LIBRARY ||
ttype == cmStateEnums::TargetType::UNKNOWN_LIBRARY) {
depname = cmStrCat("$<TARGET_LINKER_FILE:", t->GetName(), ">");
}
}
- dependencies.push_back(depname);
+ dependencies.emplace_back(std::move(depname));
}
auto cc = cm::make_unique<cmCustomCommand>();
cc->SetWorkingDirectory(this->Dir.Work.c_str());
- cc->SetByproducts(timestampTargetProvides);
cc->SetDepends(dependencies);
- cc->SetCommandLines(timestampTargetCommandLines);
cc->SetEscapeOldStyle(false);
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
timestampTargetName, true, std::move(cc));
@@ -1478,7 +1474,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
}
if (!useNinjaDepfile) {
// Add additional autogen target dependencies to autogen target
- for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
+ for (cmTarget const* depTarget : this->AutogenTarget.DependTargets) {
autogenTarget->AddUtility(depTarget->GetName(), false, this->Makefile);
}
}
@@ -2002,7 +1998,7 @@ static cmQtAutoGen::IntegerVersion parseMocVersion(std::string str)
cmQtAutoGen::IntegerVersion result;
static const std::string prelude = "moc ";
- size_t pos = str.find(prelude);
+ size_t const pos = str.find(prelude);
if (pos == std::string::npos) {
return result;
}
@@ -2120,7 +2116,7 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target,
res.first = knownQtVersions.at(0);
} else {
// Pick a version from the known versions:
- for (auto it : knownQtVersions) {
+ for (auto const& it : knownQtVersions) {
if (it.Major == res.second) {
res.first = it;
break;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4025967..81497f5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1210,7 +1210,8 @@ void cmTarget::SetLanguageStandardProperty(std::string const& lang,
languageStandardProperty.Backtraces.emplace_back(featureBacktrace);
}
-void cmTarget::AddUtility(std::string const& name, bool cross, cmMakefile* mf)
+void cmTarget::AddUtility(std::string const& name, bool cross,
+ cmMakefile const* mf)
{
this->impl->Utilities.insert(BT<std::pair<std::string, bool>>(
{ name, cross }, mf ? mf->GetBacktrace() : cmListFileBacktrace()));
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ac6d130..2d12a70 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -174,7 +174,7 @@ public:
* commands. It is not a full path nor does it have an extension.
*/
void AddUtility(std::string const& name, bool cross,
- cmMakefile* mf = nullptr);
+ cmMakefile const* mf = nullptr);
void AddUtility(BT<std::pair<std::string, bool>> util);
//! Get the utilities used by this target
std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const;