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

Method DetermineHasMacOSXRpathInstallNameDir

Source/cmGeneratorTarget.cxx:1519–1578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1517}
1518
1519bool cmGeneratorTarget::DetermineHasMacOSXRpathInstallNameDir(
1520 std::string const& config) const
1521{
1522 bool install_name_is_rpath = false;
1523 bool macosx_rpath = false;
1524
1525 if (!this->IsImported()) {
1526 if (this->GetType() != cmStateEnums::SHARED_LIBRARY) {
1527 return false;
1528 }
1529 cmValue install_name = this->GetProperty("INSTALL_NAME_DIR");
1530 bool use_install_name = this->MacOSXUseInstallNameDir();
1531 if (install_name && use_install_name && *install_name == "@rpath") {
1532 install_name_is_rpath = true;
1533 } else if (install_name && use_install_name) {
1534 return false;
1535 }
1536 if (!install_name_is_rpath) {
1537 macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
1538 }
1539 } else {
1540 // Lookup the imported soname.
1541 if (cmGeneratorTarget::ImportInfo const* info =
1542 this->GetImportInfo(config)) {
1543 if (!info->NoSOName && !info->SOName.empty()) {
1544 if (cmHasLiteralPrefix(info->SOName, "@rpath/")) {
1545 install_name_is_rpath = true;
1546 }
1547 } else {
1548 std::string install_name;
1549 cmSystemTools::GuessLibraryInstallName(info->Location, install_name);
1550 if (install_name.find("@rpath") != std::string::npos) {
1551 install_name_is_rpath = true;
1552 }
1553 }
1554 }
1555 }
1556
1557 if (!install_name_is_rpath && !macosx_rpath) {
1558 return false;
1559 }
1560
1561 if (!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG")) {
1562 std::ostringstream w;
1563 w << "Attempting to use ";
1564 if (macosx_rpath) {
1565 w << "MACOSX_RPATH";
1566 } else {
1567 w << "@rpath";
1568 }
1569 w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set.";
1570 w << " This could be because you are using a Mac OS X version";
1571 w << " less than 10.5 or because CMake's platform configuration is";
1572 w << " corrupt.";
1573 cmake* cm = this->LocalGenerator->GetCMakeInstance();
1574 cm->IssueMessage(MessageType::FATAL_ERROR, w.str(), this->GetBacktrace());
1575 }
1576

Callers 1

Calls 14

IsImportedMethod · 0.95
GetTypeMethod · 0.95
GetPropertyMethod · 0.95
GetImportInfoMethod · 0.95
GetBacktraceMethod · 0.95
cmHasLiteralPrefixFunction · 0.85
strMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
IsSetMethod · 0.45

Tested by

no test coverage detected