summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-07-16 15:03:58 (GMT)
committerBrad King <brad.king@kitware.com>2008-07-16 15:03:58 (GMT)
commit2bc9acb1cad11f86ac737658a2355d80420133a5 (patch)
treed7305d756ad5070737825d95577e68876b1ddcd7 /Source/cmGlobalGenerator.cxx
parent299a0c826b22f061effbf830502eb9aa19a7ed98 (diff)
downloadCMake-2bc9acb1cad11f86ac737658a2355d80420133a5.zip
CMake-2bc9acb1cad11f86ac737658a2355d80420133a5.tar.gz
CMake-2bc9acb1cad11f86ac737658a2355d80420133a5.tar.bz2
BUG: Fix try_compile during EnableLanguage
- The source-file signature of try_compile looks up the language of the source file using the extension-to-language map so that it knows what language to enable in the generated project. - This map needs to be filled before loading a file specified by CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG> so that the user file may call the try_compile() source-file signature. - It must still be re-filled after loading CMake<LANG>Information.cmake in case the compiler- or platform-specific files added anything. - See bug #7340.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx41
1 files changed, 32 insertions, 9 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index e6436e4..83733bf 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -559,6 +559,11 @@ for checking whether the language is already enabled. After setting this
flag still the values from the cmake variables have to be copied into the
internal maps, this is done in SetLanguageEnabledMaps() which is called
after the system- and compiler specific files have been loaded.
+
+This split was done originally so that compiler-specific configuration
+files could change the object file extension
+(CMAKE_<LANG>_OUTPUT_EXTENSION) before the CMake variables were copied
+to the C++ maps.
*/
void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
{
@@ -566,9 +571,16 @@ void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
this->SetLanguageEnabledMaps(l, mf);
}
-void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile*)
+void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
{
this->LanguageEnabled[l] = true;
+
+ // Fill the language-to-extension map with the current variable
+ // settings to make sure it is available for the try_compile()
+ // command source file signature. In SetLanguageEnabledMaps this
+ // will be done again to account for any compiler- or
+ // platform-specific entries.
+ this->FillExtensionToLanguageMap(l, mf);
}
void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
@@ -627,26 +639,37 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
}
}
- std::string extensionsVar = std::string("CMAKE_") +
- std::string(l) + std::string("_SOURCE_FILE_EXTENSIONS");
+ // The map was originally filled by SetLanguageEnabledFlag, but
+ // since then the compiler- and platform-specific files have been
+ // loaded which might have added more entries.
+ this->FillExtensionToLanguageMap(l, mf);
+
std::string ignoreExtensionsVar = std::string("CMAKE_") +
std::string(l) + std::string("_IGNORE_EXTENSIONS");
std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar.c_str());
- std::string exts = mf->GetSafeDefinition(extensionsVar.c_str());
std::vector<std::string> extensionList;
- cmSystemTools::ExpandListArgument(exts, extensionList);
+ cmSystemTools::ExpandListArgument(ignoreExts, extensionList);
for(std::vector<std::string>::iterator i = extensionList.begin();
i != extensionList.end(); ++i)
{
- this->ExtensionToLanguage[*i] = l;
+ this->IgnoreExtensions[*i] = true;
}
- cmSystemTools::ExpandListArgument(ignoreExts, extensionList);
+
+}
+
+void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
+ cmMakefile* mf)
+{
+ std::string extensionsVar = std::string("CMAKE_") +
+ std::string(l) + std::string("_SOURCE_FILE_EXTENSIONS");
+ std::string exts = mf->GetSafeDefinition(extensionsVar.c_str());
+ std::vector<std::string> extensionList;
+ cmSystemTools::ExpandListArgument(exts, extensionList);
for(std::vector<std::string>::iterator i = extensionList.begin();
i != extensionList.end(); ++i)
{
- this->IgnoreExtensions[*i] = true;
+ this->ExtensionToLanguage[*i] = l;
}
-
}
bool cmGlobalGenerator::IgnoreFile(const char* l)