summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-03-12 21:29:04 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-07-08 14:13:51 (GMT)
commitdc2e26df01eb4230a69c43a05b867fce330f57a4 (patch)
tree47fbf868a295ed913084a5d47e917a653d293a7d /Source
parentd2803fbac6ca20c998ff5364e79f0841eba6c579 (diff)
downloadCMake-dc2e26df01eb4230a69c43a05b867fce330f57a4.zip
CMake-dc2e26df01eb4230a69c43a05b867fce330f57a4.tar.gz
CMake-dc2e26df01eb4230a69c43a05b867fce330f57a4.tar.bz2
cmMakefile: Avoid excess source files
When there are no commands, a main_dependency is not required and when there are also no dependencies, nothing is required.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx49
1 files changed, 26 insertions, 23 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c4543d7..452d3f6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -989,7 +989,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Choose a source file on which to store the custom command.
cmSourceFile* file = 0;
- if(!main_dependency.empty())
+ if(!commandLines.empty() && !main_dependency.empty())
{
// The main dependency was specified. Use it unless a different
// custom command already used it.
@@ -1257,28 +1257,31 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
}
// Store the custom command in the target.
- std::string force = this->GetStartOutputDirectory();
- force += cmake::GetCMakeFilesDirectory();
- force += "/";
- force += utilityName;
- std::string no_main_dependency = "";
- bool no_replace = false;
- this->AddCustomCommandToOutput(force, depends,
- no_main_dependency,
- commandLines, comment,
- workingDirectory, no_replace,
- escapeOldStyle);
- cmSourceFile* sf = target->AddSourceCMP0049(force);
-
- // The output is not actually created so mark it symbolic.
- if(sf)
- {
- sf->SetProperty("SYMBOLIC", "1");
- }
- else
- {
- cmSystemTools::Error("Could not get source file entry for ",
- force.c_str());
+ if (!commandLines.empty() || !depends.empty())
+ {
+ std::string force = this->GetStartOutputDirectory();
+ force += cmake::GetCMakeFilesDirectory();
+ force += "/";
+ force += utilityName;
+ std::string no_main_dependency = "";
+ bool no_replace = false;
+ this->AddCustomCommandToOutput(force, depends,
+ no_main_dependency,
+ commandLines, comment,
+ workingDirectory, no_replace,
+ escapeOldStyle);
+ cmSourceFile* sf = target->AddSourceCMP0049(force);
+
+ // The output is not actually created so mark it symbolic.
+ if(sf)
+ {
+ sf->SetProperty("SYMBOLIC", "1");
+ }
+ else
+ {
+ cmSystemTools::Error("Could not get source file entry for ",
+ force.c_str());
+ }
}
return target;
}