VS10: stop build on custom command error (#11533)
In VS9 and previous versions, :VCReportError is the goto label to jump to after a failed custom command. It stops the build before it tries to go any further. In VS10, :VCEnd is the correct label to use. Create a method in the VS generators to provide the correct line of script to use for each version of Visual Studio. For more internal details, search for VCEnd in the C:\Program Files\MSBuild directory.
This commit is contained in:
parent
d11c70295b
commit
66e7917532
|
@ -117,3 +117,9 @@ void cmLocalVisualStudio10Generator
|
||||||
"Stored GUID",
|
"Stored GUID",
|
||||||
cmCacheManager::INTERNAL);
|
cmCacheManager::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmLocalVisualStudio10Generator::CheckForErrorLine()
|
||||||
|
{
|
||||||
|
return "if errorlevel 1 goto :VCEnd";
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,10 @@ public:
|
||||||
virtual void Generate();
|
virtual void Generate();
|
||||||
virtual void ReadAndStoreExternalGUID(const char* name,
|
virtual void ReadAndStoreExternalGUID(const char* name,
|
||||||
const char* path);
|
const char* path);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual std::string CheckForErrorLine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -148,6 +148,18 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
||||||
this->InsertNeedObjectNames(sourceGroups, objectNameCounts);
|
this->InsertNeedObjectNames(sourceGroups, objectNameCounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmLocalVisualStudioGenerator::CheckForErrorLine()
|
||||||
|
{
|
||||||
|
return "if errorlevel 1 goto :VCReportError";
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine()
|
||||||
|
{
|
||||||
|
return this->CheckForErrorLine();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalVisualStudioGenerator
|
cmLocalVisualStudioGenerator
|
||||||
|
@ -237,7 +249,7 @@ cmLocalVisualStudioGenerator
|
||||||
// sequence.
|
// sequence.
|
||||||
//
|
//
|
||||||
script += newline_text;
|
script += newline_text;
|
||||||
script += "if errorlevel 1 goto VCReportError";
|
script += this->GetCheckForErrorLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
return script;
|
return script;
|
||||||
|
|
|
@ -30,6 +30,7 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator
|
||||||
public:
|
public:
|
||||||
cmLocalVisualStudioGenerator();
|
cmLocalVisualStudioGenerator();
|
||||||
virtual ~cmLocalVisualStudioGenerator();
|
virtual ~cmLocalVisualStudioGenerator();
|
||||||
|
|
||||||
/** Construct a script from the given list of command lines. */
|
/** Construct a script from the given list of command lines. */
|
||||||
std::string ConstructScript(const cmCustomCommandLines& commandLines,
|
std::string ConstructScript(const cmCustomCommandLines& commandLines,
|
||||||
const char* workingDirectory,
|
const char* workingDirectory,
|
||||||
|
@ -38,7 +39,13 @@ public:
|
||||||
bool escapeAllowMakeVars,
|
bool escapeAllowMakeVars,
|
||||||
const char* newline = "\n");
|
const char* newline = "\n");
|
||||||
|
|
||||||
|
/** Line of batch file text that skips to the end after
|
||||||
|
* a failed step in a sequence of custom commands.
|
||||||
|
*/
|
||||||
|
std::string GetCheckForErrorLine();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual std::string CheckForErrorLine();
|
||||||
|
|
||||||
/** Construct a custom command to make exe import lib dir. */
|
/** Construct a custom command to make exe import lib dir. */
|
||||||
cmsys::auto_ptr<cmCustomCommand>
|
cmsys::auto_ptr<cmCustomCommand>
|
||||||
|
|
Loading…
Reference in New Issue