MCPcopy Create free account
hub / github.com/Kitware/CMake / GetPchCreateCompileOptions

Method GetPchCreateCompileOptions

Source/cmGeneratorTarget.cxx:3263–3309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3261}
3262
3263std::string cmGeneratorTarget::GetPchCreateCompileOptions(
3264 std::string const& config, std::string const& language,
3265 std::string const& arch)
3266{
3267 auto const inserted = this->PchCreateCompileOptions.insert(
3268 std::make_pair(language + config + arch, ""));
3269 if (inserted.second) {
3270 std::string& createOptionList = inserted.first->second;
3271
3272 if (this->GetPropertyAsBool("PCH_WARN_INVALID")) {
3273 createOptionList = this->Makefile->GetSafeDefinition(
3274 cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_INVALID_PCH"));
3275 }
3276
3277 if (this->GetPropertyAsBool("PCH_INSTANTIATE_TEMPLATES")) {
3278 std::string varName = cmStrCat(
3279 "CMAKE_", language, "_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH");
3280 std::string instantiateOption =
3281 this->Makefile->GetSafeDefinition(varName);
3282 if (!instantiateOption.empty()) {
3283 createOptionList = cmStrCat(createOptionList, ';', instantiateOption);
3284 }
3285 }
3286
3287 std::string const createOptVar =
3288 cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_CREATE_PCH");
3289
3290 createOptionList = cmStrCat(
3291 createOptionList, ';', this->Makefile->GetSafeDefinition(createOptVar));
3292
3293 std::string const pchHeader = this->GetPchHeader(config, language, arch);
3294 std::string const pchFile = this->GetPchFile(config, language, arch);
3295
3296 if (GlobalGenerator->IsFastbuild()) {
3297 // Account for potential spaces in a shell-friendly way.
3298 cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>",
3299 cmStrCat('"', pchHeader, '"'));
3300 cmSystemTools::ReplaceString(createOptionList, "<PCH_FILE>",
3301 cmStrCat('"', pchFile, '"'));
3302 } else {
3303 cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>",
3304 pchHeader);
3305 cmSystemTools::ReplaceString(createOptionList, "<PCH_FILE>", pchFile);
3306 }
3307 }
3308 return inserted.first->second;
3309}
3310
3311std::string cmGeneratorTarget::GetPchUseCompileOptions(
3312 std::string const& config, std::string const& language,

Callers 6

WriteObjectRuleFilesMethod · 0.80
ComputeFlagsForObjectMethod · 0.80
ComputePCHMethod · 0.80
BuildCompileDataMethod · 0.80

Calls 7

GetPropertyAsBoolMethod · 0.95
GetPchHeaderMethod · 0.95
GetPchFileMethod · 0.95
cmStrCatFunction · 0.70
insertMethod · 0.45
emptyMethod · 0.45
IsFastbuildMethod · 0.45

Tested by

no test coverage detected