summaryrefslogtreecommitdiff
path: root/Source/cmMakefileUtilityTargetGenerator.cxx
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-11 15:16:57 +0900
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-11 15:16:57 +0900
commit915c76ded744c0f5f151402b9fa69f3fd8452573 (patch)
treeca6a387466543248890f346847acaa8343989b22 /Source/cmMakefileUtilityTargetGenerator.cxx
parent317dbdb79761ef65e45c7358cfc7571c6afa54ad (diff)
downloadcmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.gz
cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.bz2
cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.zip
Imported Upstream version 3.9.4upstream/3.9.4
Diffstat (limited to 'Source/cmMakefileUtilityTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx96
1 files changed, 45 insertions, 51 deletions
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 1fa4e95b6..a7c5d27f2 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -1,62 +1,57 @@
-/*============================================================================
- CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileUtilityTargetGenerator.h"
+#include <ostream>
+#include <string>
+#include <vector>
+
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
-#include "cmTarget.h"
+#include "cmOSXBundleGenerator.h"
+#include "cmSystemTools.h"
-//----------------------------------------------------------------------------
-cmMakefileUtilityTargetGenerator
-::cmMakefileUtilityTargetGenerator(cmTarget* target):
- cmMakefileTargetGenerator(target)
+cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
+ cmGeneratorTarget* target)
+ : cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnUtility;
- this->OSXBundleGenerator = new cmOSXBundleGenerator(this->Target,
- this->ConfigName);
+ this->OSXBundleGenerator =
+ new cmOSXBundleGenerator(target, this->ConfigName);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
-//----------------------------------------------------------------------------
-cmMakefileUtilityTargetGenerator
-::~cmMakefileUtilityTargetGenerator()
+cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator()
{
delete this->OSXBundleGenerator;
}
-//----------------------------------------------------------------------------
void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
{
this->CreateRuleFile();
- *this->BuildFileStream
- << "# Utility rule file for " << this->Target->GetName() << ".\n\n";
+ *this->BuildFileStream << "# Utility rule file for "
+ << this->GeneratorTarget->GetName() << ".\n\n";
- if(!this->NoRuleMessages)
- {
- const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")?
- "$(CMAKE_BINARY_DIR)/" : "");
+ if (!this->NoRuleMessages) {
+ const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
+ ? "$(CMAKE_BINARY_DIR)/"
+ : "");
// Include the progress variables for the target.
*this->BuildFileStream
<< "# Include the progress variables for this target.\n"
- << this->LocalGenerator->IncludeDirective << " " << root
- << this->Convert(this->ProgressFileNameFull.c_str(),
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKEFILE)
+ << this->GlobalGenerator->IncludeDirective << " " << root
+ << cmSystemTools::ConvertToOutputPath(
+ this->LocalGenerator
+ ->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetBinaryDirectory(),
+ this->ProgressFileNameFull)
+ .c_str())
<< "\n\n";
- }
+ }
// write the custom commands for this target
this->WriteTargetBuildRules();
@@ -66,20 +61,22 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
std::vector<std::string> depends;
// Utility targets store their rules in pre- and post-build commands.
- this->LocalGenerator->AppendCustomDepends
- (depends, this->Target->GetPreBuildCommands());
+ this->LocalGenerator->AppendCustomDepends(
+ depends, this->GeneratorTarget->GetPreBuildCommands());
- this->LocalGenerator->AppendCustomDepends
- (depends, this->Target->GetPostBuildCommands());
+ this->LocalGenerator->AppendCustomDepends(
+ depends, this->GeneratorTarget->GetPostBuildCommands());
- this->LocalGenerator->AppendCustomCommands
- (commands, this->Target->GetPreBuildCommands(), this->Target);
+ this->LocalGenerator->AppendCustomCommands(
+ commands, this->GeneratorTarget->GetPreBuildCommands(),
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
// Depend on all custom command outputs for sources
this->DriveCustomCommands(depends);
- this->LocalGenerator->AppendCustomCommands
- (commands, this->Target->GetPostBuildCommands(), this->Target);
+ this->LocalGenerator->AppendCustomCommands(
+ commands, this->GeneratorTarget->GetPostBuildCommands(),
+ this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
// Add dependencies on targets that must be built first.
this->AppendTargetDepends(depends);
@@ -90,22 +87,20 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// If the rule is empty add the special empty rule dependency needed
// by some make tools.
- if(depends.empty() && commands.empty())
- {
+ if (depends.empty() && commands.empty()) {
std::string hack = this->GlobalGenerator->GetEmptyRuleHackDepends();
- if(!hack.empty())
- {
+ if (!hack.empty()) {
depends.push_back(hack);
- }
}
+ }
// Write the rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- this->Target->GetName(),
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ this->GeneratorTarget->GetName(),
depends, commands, true);
// Write the main driver rule to build everything in this target.
- this->WriteTargetDriverRule(this->Target->GetName(), false);
+ this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false);
// Write clean target
this->WriteTargetCleanRules();
@@ -117,4 +112,3 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// close the streams
this->CloseFileStreams();
}
-