cmGlobalGenerator: Do not re-add CMAKE_<LANG>_COMPILER

The cmGlobalGenerator::ResolveLanguageCompiler method, invoked only by
Makefile generators, contains code originally added by commit v2.4.0~796
(..., add new generators for msys and mingw, 2005-12-22) to compute the
full path to the compiler and save the result back into the cache value.
Since then the CMakeDetermine*Compiler modules have learned to resolve
the full path to the compiler and save it in CMake*Compiler.cmake files
configured in the build tree.  The value of CMAKE_<LANG>_COMPILER in the
cache is now only for reference of what the user originally specified.
The full path is now available in a normal variable of the same name,
and this is used by project code and the generators.

When the user specifies -DCMAKE_<LANG>_COMPILER=name on the command-line
of an existing build tree that uses a Makefile generator, it is first
stored in the cache with an uninitialized type.  Then later when
ResolveLanguageCompiler updates the cache entry and sets the type to
FILEPATH, cmMakefile::AddCacheDefinition does CollapseFullPath on the
"name" and ends up with something like "$PWD/name" which is unlikely to
be correct.  Furthermore, cmMakefile::AddCacheDefinition proceeds to
remove the normal variable of the same name, so the value originally
saved in CMake<LANG>Compiler.cmake is ignored and the generators use the
wrong path to the compiler.

Resolve this by dropping the code from ResolveLanguageCompiler that
touches the cache value of CMAKE_<LANG>_COMPILER.  As explained above it
is no longer needed anyway.
This commit is contained in:
Brad King 2014-07-24 12:44:05 -04:00
parent fe4e6ed991
commit 731427a646
1 changed files with 0 additions and 4 deletions

View File

@ -148,8 +148,6 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
{
return;
}
std::string doc = lang;
doc += " compiler.";
const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetCacheValue(langComp);
std::string changeVars;
@ -186,8 +184,6 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
changeVars.c_str());
}
}
mf->AddCacheDefinition(langComp, path.c_str(),
doc.c_str(), cmCacheManager::FILEPATH);
}
void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)