Fix resetting the compiler on the command line (#14366).

Convert the incoming value to a path in the same way that the
already-cached value was converted before comparison.

Do the actual comparison only one time, after both values are
normalized.
This commit is contained in:
Stephen Kelly 2013-08-19 14:12:56 +02:00
parent 79af005cf8
commit 8b2a2db073
1 changed files with 10 additions and 2 deletions

View File

@ -146,9 +146,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetCacheValue(langComp.c_str());
std::string changeVars;
if(cname && (path != cname) && (optional==false))
if(cname && !optional)
{
std::string cnameString = cname;
std::string cnameString;
if(!cmSystemTools::FileIsFullPath(cname))
{
cnameString = cmSystemTools::FindProgram(cname);
}
else
{
cnameString = cname;
}
std::string pathString = path;
// get rid of potentially multiple slashes:
cmSystemTools::ConvertToUnixSlashes(cnameString);