diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-01-05 16:01:22 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-01-16 15:41:38 (GMT) |
commit | 14f3ba205989a422f1668073a325b057cece0b32 (patch) | |
tree | 16c0289473b6c09183b912777be626d76e9bd8c6 /Source | |
parent | 702121c5f3eceeb6b74ede845f1e1297cf113c47 (diff) | |
download | CMake-14f3ba205989a422f1668073a325b057cece0b32.zip CMake-14f3ba205989a422f1668073a325b057cece0b32.tar.gz CMake-14f3ba205989a422f1668073a325b057cece0b32.tar.bz2 |
GHS: EXCLUDE_FROM_ALL updates
-- Excluded targets should be generated but not included in build ALL
-- Use the correct source list for this configuration when writing sources
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 79 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.h | 2 |
4 files changed, 33 insertions, 70 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 0cd6312..5e6224f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -108,56 +108,34 @@ void cmGhsMultiTargetGenerator::Generate() void cmGhsMultiTargetGenerator::GenerateTarget() { - // Skip if empty or not included in build - if (!this->GetSources().empty() && this->IncludeThisTarget()) { - - // Open the filestream in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->Name; - fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fout(fname.c_str()); - fout.SetCopyIfDifferent(true); - - this->GetGlobalGenerator()->WriteFileHeader(fout); - GhsMultiGpj::WriteGpjTag(this->TagType, fout); - const std::string language( - this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - this->DynamicDownload = - this->DetermineIfDynamicDownload(this->ConfigName, language); - if (this->DynamicDownload) { - fout << "#component integrity_dynamic_download" << std::endl; - } - this->WriteTargetSpecifics(fout, this->ConfigName); - this->SetCompilerFlags(this->ConfigName, language); - this->WriteCompilerFlags(fout, this->ConfigName, language); - this->WriteCompilerDefinitions(fout, this->ConfigName, language); - this->WriteIncludes(fout, this->ConfigName, language); - this->WriteTargetLinkLine(fout, this->ConfigName); - this->WriteCustomCommands(fout); - this->WriteSources(fout); - - fout.Close(); - } -} - -bool cmGhsMultiTargetGenerator::IncludeThisTarget() -{ - bool output = true; - char const* excludeFromAll = - this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - output = false; + // Open the filestream in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->Name; + fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fout(fname.c_str()); + fout.SetCopyIfDifferent(true); + + this->GetGlobalGenerator()->WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(this->TagType, fout); + + const std::string language( + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); + this->DynamicDownload = + this->DetermineIfDynamicDownload(this->ConfigName, language); + if (this->DynamicDownload) { + fout << "#component integrity_dynamic_download" << std::endl; } - return output; -} - -std::vector<cmSourceFile*> cmGhsMultiTargetGenerator::GetSources() const -{ - std::vector<cmSourceFile*> output; - this->GeneratorTarget->GetSourceFiles(output, this->ConfigName); - return output; + this->WriteTargetSpecifics(fout, this->ConfigName); + this->SetCompilerFlags(this->ConfigName, language); + this->WriteCompilerFlags(fout, this->ConfigName, language); + this->WriteCompilerDefinitions(fout, this->ConfigName, language); + this->WriteIncludes(fout, this->ConfigName, language); + this->WriteTargetLinkLine(fout, this->ConfigName); + this->WriteCustomCommands(fout); + this->WriteSources(fout); + + fout.Close(); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -431,7 +409,8 @@ cmGhsMultiTargetGenerator::GetObjectNames( void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { /* vector of all sources for this target */ - std::vector<cmSourceFile*> sources = this->GetSources(); + std::vector<cmSourceFile*> sources; + this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); /* vector of all groups defined for this target * -- but the vector is not expanded with sub groups or in any useful order diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 343044a..5d67112 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -24,9 +24,6 @@ public: virtual void Generate(); - bool IncludeThisTarget(); - std::vector<cmSourceFile*> GetSources() const; - private: cmGlobalGhsMultiGenerator* GetGlobalGenerator() const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 452a610..f2f43e3 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -311,6 +311,10 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( dir += "/"; } } + + if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { + fout << "{comment} "; + } fout << dir << projName << FILE_EXTENSION; fout << " " << projType << std::endl; } @@ -441,21 +445,6 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) } } -bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget* tgt) -{ - const std::string config = - tgt->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - std::vector<cmSourceFile*> tgtSources; - tgt->GetSourceFiles(tgtSources, config); - bool tgtInBuild = true; - char const* excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - tgtInBuild = false; - } - return !tgtSources.empty() && tgtInBuild; -} - std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const& str) { std::string result; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 71c0b48..d926575 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,8 +111,6 @@ private: void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); - bool IsTgtForBuild(const cmGeneratorTarget* tgt); - std::string trimQuotes(std::string const& str); static const char* DEFAULT_BUILD_PROGRAM; |