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

Method GetCustomObjectFileName

Source/cmLocalGenerator.cxx:4389–4475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4387}
4388
4389std::string cmLocalGenerator::GetCustomObjectFileName(
4390 cmSourceFile const& source) const
4391{
4392 if (!this->GetGlobalGenerator()->SupportsCustomObjectNames()) {
4393 return std::string{};
4394 }
4395
4396 if (auto objName = source.GetProperty("OBJECT_NAME")) {
4397 cmGeneratorExpression ge(*this->GetCMakeInstance());
4398 auto cge = ge.Parse(objName);
4399 static std::string const INVALID_GENEX =
4400 "_cmake_invalid_object_name_genex";
4401 static std::string const INVALID_VALUE =
4402 "_cmake_invalid_object_name_value";
4403
4404 if (!cge) {
4405 this->Makefile->IssueMessage(
4406 MessageType::FATAL_ERROR,
4407 cmStrCat("The \"OBJECT_NAME\" property for\n ", source.GetFullPath(),
4408 "\nis not a valid generator expression (", objName, ")."));
4409 return INVALID_GENEX;
4410 }
4411 if (cge->GetHadHeadSensitiveCondition()) {
4412 // Not reachable; all target-sensitive genexes actually fail to parse.
4413 this->Makefile->IssueMessage(
4414 MessageType::FATAL_ERROR,
4415 cmStrCat("The \"OBJECT_NAME\" property for\n ", source.GetFullPath(),
4416 "\ncontains a condition that queries the consuming target "
4417 "which is not supported (",
4418 objName, ")."));
4419 return INVALID_GENEX;
4420 }
4421 if (cge->GetHadLinkLanguageSensitiveCondition()) {
4422 // Not reachable; all target-sensitive genexes actually fail to parse.
4423 this->Makefile->IssueMessage(
4424 MessageType::FATAL_ERROR,
4425 cmStrCat("The \"OBJECT_NAME\" property for\n ", source.GetFullPath(),
4426 "\ncontains a condition that queries the link language "
4427 "which is not supported (",
4428 objName, ")."));
4429 return INVALID_GENEX;
4430 }
4431
4432 auto objNameValue = cge->Evaluate(this, "");
4433 if (cge->GetHadContextSensitiveCondition()) {
4434 this->Makefile->IssueMessage(
4435 MessageType::FATAL_ERROR,
4436 cmStrCat("The \"OBJECT_NAME\" property for\n ", source.GetFullPath(),
4437 "\ncontains a context-sensitive condition which is not "
4438 "supported (",
4439 objName, ")."));
4440 return INVALID_GENEX;
4441 }
4442
4443 // Skip if it evaluates to empty.
4444 if (!objNameValue.empty()) {
4445 cmCMakePath objNamePath = objNameValue;
4446 // Verify that it is a relative path.

Callers 4

WriteAllSourcesMethod · 0.80

Calls 15

GetGlobalGeneratorMethod · 0.95
GetCMakeInstanceMethod · 0.95
IsAbsoluteMethod · 0.80
cmStrCatFunction · 0.70
GetPropertyMethod · 0.45
ParseMethod · 0.45
IssueMessageMethod · 0.45
GetFullPathMethod · 0.45
EvaluateMethod · 0.45

Tested by

no test coverage detected