cmLocalGenerator: Add format option to ConvertToOutputForExisting

Replace the hard-coded SHELL output format with an optional argument.
This commit is contained in:
Brad King 2014-03-04 12:57:44 -05:00
parent c87517099a
commit 02bebd60e9
2 changed files with 17 additions and 11 deletions

View File

@ -1228,7 +1228,8 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
std::string const& result)
std::string const& result,
OutputFormat format)
{
// If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a
@ -1239,7 +1240,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
std::string tmp;
if(cmSystemTools::GetShortPath(remote, tmp))
{
return this->Convert(tmp.c_str(), NONE, SHELL, true);
return this->Convert(tmp.c_str(), NONE, format, true);
}
}
@ -1250,26 +1251,28 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToOutputForExisting(const char* remote,
RelativeRoot local)
RelativeRoot local,
OutputFormat format)
{
// Perform standard conversion.
std::string result = this->Convert(remote, local, SHELL, true);
std::string result = this->Convert(remote, local, format, true);
// Consider short-path.
return this->ConvertToOutputForExistingCommon(remote, result);
return this->ConvertToOutputForExistingCommon(remote, result, format);
}
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
const char* local)
const char* local,
OutputFormat format)
{
// Perform standard conversion.
std::string result = this->Convert(remote, local, SHELL, true);
std::string result = this->Convert(remote, local, format, true);
// Consider short-path.
const char* remotePath = this->GetRelativeRootPath(remote);
return this->ConvertToOutputForExistingCommon(remotePath, result);
return this->ConvertToOutputForExistingCommon(remotePath, result, format);
}
//----------------------------------------------------------------------------

View File

@ -198,12 +198,14 @@ public:
///! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const char* remote,
RelativeRoot local = START_OUTPUT);
RelativeRoot local = START_OUTPUT,
OutputFormat format = SHELL);
/** For existing path identified by RelativeRoot convert to output
path and short path if spaces. */
std::string ConvertToOutputForExisting(RelativeRoot remote,
const char* local = 0);
const char* local = 0,
OutputFormat format = SHELL);
virtual std::string ConvertToIncludeReference(std::string const& path);
@ -465,7 +467,8 @@ protected:
bool BackwardsCompatibilityFinal;
private:
std::string ConvertToOutputForExistingCommon(const char* remote,
std::string const& result);
std::string const& result,
OutputFormat format);
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;