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

Method GetPchReuseTarget

Source/cmGeneratorTarget.cxx:2893–2944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2891};
2892
2893cmGeneratorTarget const* cmGeneratorTarget::GetPchReuseTarget() const
2894{
2895 if (this->ComputingPchReuse) {
2896 // TODO: Get the full cycle.
2897 if (!this->PchReuseCycleDetected) {
2898 this->Makefile->IssueMessage(
2899 MessageType::FATAL_ERROR,
2900 cmStrCat("Circular PCH reuse target involving '", this->GetName(),
2901 '\''));
2902 }
2903 this->PchReuseCycleDetected = true;
2904 return nullptr;
2905 }
2906 CycleWatcher watch(this->ComputingPchReuse);
2907 (void)watch;
2908 cmValue pchReuseFrom = this->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
2909 if (!pchReuseFrom) {
2910 return nullptr;
2911 }
2912 cmGeneratorTarget const* generatorTarget =
2913 this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
2914 if (!generatorTarget) {
2915 this->Makefile->IssueMessage(
2916 MessageType::FATAL_ERROR,
2917 cmStrCat(
2918 "Target \"", *pchReuseFrom, "\" for the \"", this->GetName(),
2919 R"(" target's "PRECOMPILE_HEADERS_REUSE_FROM" property does not exist.)"));
2920 }
2921 if (this->GetProperty("PRECOMPILE_HEADERS").IsOn()) {
2922 this->Makefile->IssueMessage(
2923 MessageType::FATAL_ERROR,
2924 cmStrCat("PRECOMPILE_HEADERS property is already set on target (\"",
2925 this->GetName(), "\")\n"));
2926 }
2927
2928 if (generatorTarget) {
2929 if (generatorTarget->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
2930 this->Makefile->IssueMessage(
2931 MessageType::WARNING,
2932 cmStrCat(
2933 "Target \"", *pchReuseFrom, "\" for the \"", this->GetName(),
2934 R"(" target's "PRECOMPILE_HEADERS_REUSE_FROM" property has set "DISABLE_PRECOMPILE_HEADERS"; ignoring.)"));
2935 return nullptr;
2936 }
2937
2938 if (auto const* recurseReuseTarget =
2939 generatorTarget->GetPchReuseTarget()) {
2940 return recurseReuseTarget;
2941 }
2942 }
2943 return generatorTarget;
2944}
2945
2946cmGeneratorTarget* cmGeneratorTarget::GetPchReuseTarget()
2947{

Callers 8

GetCompilePDBNameMethod · 0.95
GetPchHeaderMethod · 0.95
GetPchSourceMethod · 0.95
GetPchFileMethod · 0.95
ComputePDBOutputDirMethod · 0.95
AddPchDependenciesMethod · 0.80

Calls 8

GetPropertyMethod · 0.95
GetGlobalGeneratorMethod · 0.95
FindGeneratorTargetMethod · 0.80
cmStrCatFunction · 0.70
IssueMessageMethod · 0.45
GetNameMethod · 0.45
IsOnMethod · 0.45
GetPropertyAsBoolMethod · 0.45

Tested by

no test coverage detected