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

Method GetCustomInstallObjectFileName

Source/cmLocalGenerator.cxx:4477–4562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4475}
4476
4477std::string cmLocalGenerator::GetCustomInstallObjectFileName(
4478 cmSourceFile const& source, std::string const& config,
4479 char const* custom_ext) const
4480{
4481 if (auto objName = source.GetProperty("INSTALL_OBJECT_NAME")) {
4482 cmGeneratorExpression ge(*this->GetCMakeInstance());
4483 auto cge = ge.Parse(objName);
4484 static std::string const INVALID_GENEX =
4485 "_cmake_invalid_object_name_genex";
4486 static std::string const INVALID_VALUE =
4487 "_cmake_invalid_object_name_value";
4488
4489 if (!cge) {
4490 this->Makefile->IssueMessage(
4491 MessageType::FATAL_ERROR,
4492 cmStrCat("The \"INSTALL_OBJECT_NAME\" property for\n ",
4493 source.GetFullPath(),
4494 "\nis not a valid generator expression (", objName, ")."));
4495 return INVALID_GENEX;
4496 }
4497 if (cge->GetHadHeadSensitiveCondition()) {
4498 // Not reachable; all target-sensitive genexes actually fail to parse.
4499 this->Makefile->IssueMessage(
4500 MessageType::FATAL_ERROR,
4501 cmStrCat("The \"INSTALL_OBJECT_NAME\" property for\n ",
4502 source.GetFullPath(),
4503 "\ncontains a condition that queries the consuming target "
4504 "which is not supported (",
4505 objName, ")."));
4506 return INVALID_GENEX;
4507 }
4508 if (cge->GetHadLinkLanguageSensitiveCondition()) {
4509 // Not reachable; all target-sensitive genexes actually fail to parse.
4510 this->Makefile->IssueMessage(
4511 MessageType::FATAL_ERROR,
4512 cmStrCat("The \"INSTALL_OBJECT_NAME\" property for\n ",
4513 source.GetFullPath(),
4514 "\ncontains a condition that queries the link language "
4515 "which is not supported (",
4516 objName, ")."));
4517 return INVALID_GENEX;
4518 }
4519
4520 auto objNameValue = cge->Evaluate(this, config);
4521
4522 // Skip if it evaluates to empty.
4523 if (!objNameValue.empty()) {
4524 cmCMakePath objNamePath = objNameValue;
4525 // Verify that it is a relative path.
4526 if (objNamePath.IsAbsolute()) {
4527 this->Makefile->IssueMessage(
4528 MessageType::FATAL_ERROR,
4529 cmStrCat(
4530 "The \"INSTALL_OBJECT_NAME\" property for\n ",
4531 source.GetFullPath(),
4532 "\nresolves to an absolute path which is not supported:\n ",
4533 objNameValue));
4534 return INVALID_VALUE;

Callers 1

Calls 15

GetCMakeInstanceMethod · 0.95
GetGlobalGeneratorMethod · 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