summaryrefslogtreecommitdiffstats
path: root/Source/cmGhsMultiTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-22 13:22:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-03-22 13:22:44 (GMT)
commit89abbdd8c8db5bf587373f2a00f6a816eddd8496 (patch)
tree815aaa6b4a54b6782bfb30550a20cfa6e4ee8ccb /Source/cmGhsMultiTargetGenerator.cxx
parent4e47e9967aa9d4cd76375468e3b175cd313f3877 (diff)
parent2c43fb5be345b75d12bba227979efd74b810b49a (diff)
downloadCMake-89abbdd8c8db5bf587373f2a00f6a816eddd8496.zip
CMake-89abbdd8c8db5bf587373f2a00f6a816eddd8496.tar.gz
CMake-89abbdd8c8db5bf587373f2a00f6a816eddd8496.tar.bz2
Merge topic 'ghs-linux'
2c43fb5be3 FindThreads: Fix pthread library check in GHS Multi Generator 0404efe786 GHS: Add support for GHS Multi Generator in Linux 2060a1445c Tests: Fix file name case in GHS object library test ddad70c8a4 Tests: Run GHS tests in a separate ctest process f7dca1fc97 GHS: Fix include-what-you-use and clang-tidy diagnostics Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3006
Diffstat (limited to 'Source/cmGhsMultiTargetGenerator.cxx')
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx57
1 files changed, 33 insertions, 24 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index c73ec70..668bcbd 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -2,16 +2,29 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGhsMultiTargetGenerator.h"
-#include "cmComputeLinkInformation.h"
+#include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGhsMultiGenerator.h"
#include "cmLinkLineComputer.h"
+#include "cmLocalGenerator.h"
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetDepend.h"
+
+#include <algorithm>
+#include <assert.h>
+#include <ostream>
+#include <set>
+#include <utility>
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
: GeneratorTarget(target)
@@ -30,9 +43,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
}
}
-cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
-{
-}
+cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() = default;
void cmGhsMultiTargetGenerator::Generate()
{
@@ -99,7 +110,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget()
fname += "/";
fname += this->Name;
fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
- cmGeneratedFileStream fout(fname.c_str());
+ cmGeneratedFileStream fout(fname);
fout.SetCopyIfDifferent(true);
this->GetGlobalGenerator()->WriteFileHeader(fout);
@@ -336,10 +347,9 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
}
}
-void cmGhsMultiTargetGenerator::WriteSourceProperty(std::ostream& fout,
- const cmSourceFile* sf,
- std::string propName,
- std::string propFlag)
+void cmGhsMultiTargetGenerator::WriteSourceProperty(
+ std::ostream& fout, const cmSourceFile* sf, std::string const& propName,
+ std::string const& propFlag)
{
const char* prop = sf->GetProperty(propName);
if (prop) {
@@ -370,7 +380,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups);
std::string gn = sourceGroup->GetFullName();
groupFiles[gn].push_back(sf);
- groupNames.insert(gn);
+ groupNames.insert(std::move(gn));
}
/* list of known groups and the order they are displayed in a project file */
@@ -397,7 +407,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
}
{ /* catch-all group - is last item */
- std::string gn = "";
+ std::string gn;
auto n = groupNames.find(gn);
if (n != groupNames.end()) {
groupFilesList.back() = *n;
@@ -446,7 +456,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory();
fpath += "/";
fpath += lpath;
- cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath.c_str());
+ cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath);
f->SetCopyIfDifferent(true);
gfiles.push_back(f);
fout = f;
@@ -476,7 +486,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
"bsp" != si->GetExtension()) {
- this->WriteObjectLangOverride(*fout, si);
+ WriteObjectLangOverride(*fout, si);
}
this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I");
@@ -502,9 +512,9 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
std::ostream& fout, const cmSourceFile* sourceFile)
{
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
- if (NULL != rawLangProp) {
+ if (nullptr != rawLangProp) {
std::string sourceLangProp(rawLangProp);
- std::string extension(sourceFile->GetExtension());
+ std::string const& extension = sourceFile->GetExtension();
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
fout << " -dotciscxx" << std::endl;
}
@@ -540,20 +550,19 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout)
}
}
-bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp(void)
+bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
{
const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app");
if (p) {
return cmSystemTools::IsOn(
this->GeneratorTarget->GetProperty("ghs_integrity_app"));
- } else {
- std::vector<cmSourceFile*> sources;
- this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
- for (auto& sf : sources) {
- if ("int" == sf->GetExtension()) {
- return true;
- }
+ }
+ std::vector<cmSourceFile*> sources;
+ this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
+ for (auto& sf : sources) {
+ if ("int" == sf->GetExtension()) {
+ return true;
}
- return false;
}
+ return false;
}