summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-11 20:22:04 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-07-11 20:22:04 (GMT)
commitbea1a5de771832463299146b4f2e4317c37f30bc (patch)
treeb22c7527b5e9d4b21971f6b3d6d8aeda84e0015a /Source/cmGlobalGenerator.cxx
parent9f16292b6a3a5959b2e7ddb11e54029b02701965 (diff)
downloadCMake-bea1a5de771832463299146b4f2e4317c37f30bc.zip
CMake-bea1a5de771832463299146b4f2e4317c37f30bc.tar.gz
CMake-bea1a5de771832463299146b4f2e4317c37f30bc.tar.bz2
ENH: CMAKE_<LANG>_LINKER_PREFERENCE is now an integer priority, not a
two-step priority (None or Prefered) Current order: ASM 0, C 10, Fortran 20, CXX 30, Java 40 This is the same order as automake choses: http://www.gnu.org/software/automake/manual/html_node/How-the-Linker-is-Chosen.html This change should be backward compatible: if there is a project using fortran and CXX, they had to set the LINKER_LANGUAGE explicitely, otherwise cmake complained (but still generated the project files). Explicitely setting the linker language still overrides automatic detection. If somebody has a custom language for cmake and the PREFERENCE starts with "P", its changed to 100, which gives it preference over all other languages (except the other custom languages which have also "Prefered"). "None" is converted to 0. Alex
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx42
1 files changed, 31 insertions, 11 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cea5b2b..31adcf1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -570,12 +570,35 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
std::string linkerPrefVar = std::string("CMAKE_") +
std::string(l) + std::string("_LINKER_PREFERENCE");
const char* linkerPref = mf->GetDefinition(linkerPrefVar.c_str());
- if(!linkerPref)
+ int preference = 0;
+ if(linkerPref)
{
- linkerPref = "None";
+ if (sscanf(linkerPref, "%d", &preference)!=1)
+ {
+ // backward compatibility: before 2.6 LINKER_PREFERENCE
+ // was either "None" or "Prefered", and only the first character was
+ // tested. So if there is a custom language out there and it is
+ // "Prefered", set its preference high
+ if (linkerPref[0]=='P')
+ {
+ preference = 100;
+ }
+ else
+ {
+ preference = 0;
+ }
+ }
}
- this->LanguageToLinkerPreference[l] = linkerPref;
+ if (preference < 0)
+ {
+ std::string msg = linkerPrefVar;
+ msg += " is negative, adjusting it to 0";
+ cmSystemTools::Message(msg.c_str(), "Warning");
+ preference = 0;
+ }
+
+ this->LanguageToLinkerPreference[l] = preference;
std::string outputExtensionVar = std::string("CMAKE_") +
std::string(l) + std::string("_OUTPUT_EXTENSION");
@@ -752,10 +775,6 @@ void cmGlobalGenerator::Configure()
}
notFoundVars += "\n";
}
- cmSystemTools::Error("This project requires some variables to be set,\n"
- "and cmake can not find them.\n"
- "Please set the following variables:\n",
- notFoundVars.c_str());
}
// at this point this->LocalGenerators has been filled,
// so create the map from project name to vector of local generators
@@ -1120,13 +1139,14 @@ void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
}
}
-const char* cmGlobalGenerator::GetLinkerPreference(const char* lang)
+int cmGlobalGenerator::GetLinkerPreference(const char* lang)
{
- if(this->LanguageToLinkerPreference.count(lang))
+ std::map<cmStdString, int>::const_iterator it = this->LanguageToLinkerPreference.find(lang);
+ if (it != this->LanguageToLinkerPreference.end())
{
- return this->LanguageToLinkerPreference[lang].c_str();
+ return it->second;
}
- return "None";
+ return 0;
}
void cmGlobalGenerator::FillProjectMap()