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.
This commit is contained in:
parent
d2803fbac6
commit
dc2e26df01
|
@ -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,6 +1257,8 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
|
|||
}
|
||||
|
||||
// Store the custom command in the target.
|
||||
if (!commandLines.empty() || !depends.empty())
|
||||
{
|
||||
std::string force = this->GetStartOutputDirectory();
|
||||
force += cmake::GetCMakeFilesDirectory();
|
||||
force += "/";
|
||||
|
@ -1280,6 +1282,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
|
|||
cmSystemTools::Error("Could not get source file entry for ",
|
||||
force.c_str());
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue