From 8b2a2db0735a836c6ebe40458b9a95ac08e61ea9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 19 Aug 2013 14:12:56 +0200 Subject: [PATCH] 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. --- Source/cmGlobalGenerator.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7f2b592f3..799bbdbae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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);