From 731427a646cd0ca81aa392872d18d125e917bf47 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 24 Jul 2014 12:44:05 -0400 Subject: cmGlobalGenerator: Do not re-add CMAKE__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__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__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 CMakeCompiler.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__COMPILER. As explained above it is no longer needed anyway. --- Source/cmGlobalGenerator.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ae6861e..249373c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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) -- cgit v0.12