| 1165 | } |
| 1166 | |
| 1167 | void cmGlobalGenerator::SetLanguageEnabledMaps(std::string const& l, |
| 1168 | cmMakefile* mf) |
| 1169 | { |
| 1170 | // use LanguageToLinkerPreference to detect whether this functions has |
| 1171 | // run before |
| 1172 | if (cm::contains(this->LanguageToLinkerPreference, l)) { |
| 1173 | return; |
| 1174 | } |
| 1175 | |
| 1176 | std::string linkerPrefVar = cmStrCat("CMAKE_", l, "_LINKER_PREFERENCE"); |
| 1177 | cmValue linkerPref = mf->GetDefinition(linkerPrefVar); |
| 1178 | int preference = 0; |
| 1179 | if (cmNonempty(linkerPref)) { |
| 1180 | if (sscanf(linkerPref->c_str(), "%d", &preference) != 1) { |
| 1181 | // backward compatibility: before 2.6 LINKER_PREFERENCE |
| 1182 | // was either "None" or "Preferred", and only the first character was |
| 1183 | // tested. So if there is a custom language out there and it is |
| 1184 | // "Preferred", set its preference high |
| 1185 | if ((*linkerPref)[0] == 'P') { |
| 1186 | preference = 100; |
| 1187 | } else { |
| 1188 | preference = 0; |
| 1189 | } |
| 1190 | } |
| 1191 | } |
| 1192 | |
| 1193 | if (preference < 0) { |
| 1194 | std::string msg = |
| 1195 | cmStrCat(linkerPrefVar, " is negative, adjusting it to 0"); |
| 1196 | cmSystemTools::Message(msg, "Warning"); |
| 1197 | preference = 0; |
| 1198 | } |
| 1199 | |
| 1200 | this->LanguageToLinkerPreference[l] = preference; |
| 1201 | |
| 1202 | std::string outputExtensionVar = cmStrCat("CMAKE_", l, "_OUTPUT_EXTENSION"); |
| 1203 | if (cmValue p = mf->GetDefinition(outputExtensionVar)) { |
| 1204 | std::string outputExtension = *p; |
| 1205 | this->LanguageToOutputExtension[l] = outputExtension; |
| 1206 | this->OutputExtensions[outputExtension] = outputExtension; |
| 1207 | if (cmHasPrefix(outputExtension, '.')) { |
| 1208 | outputExtension = outputExtension.substr(1); |
| 1209 | this->OutputExtensions[outputExtension] = outputExtension; |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | // The map was originally filled by SetLanguageEnabledFlag, but |
| 1214 | // since then the compiler- and platform-specific files have been |
| 1215 | // loaded which might have added more entries. |
| 1216 | this->FillExtensionToLanguageMap(l, mf); |
| 1217 | |
| 1218 | std::string ignoreExtensionsVar = |
| 1219 | cmStrCat("CMAKE_", l, "_IGNORE_EXTENSIONS"); |
| 1220 | std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar); |
| 1221 | cmList extensionList{ ignoreExts }; |
| 1222 | for (std::string const& i : extensionList) { |
| 1223 | this->IgnoreExtensions[i] = true; |
| 1224 | } |
no test coverage detected