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

Function HandleMappedPackageInfo

Source/cmInstallCommand.cxx:2078–2184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2076}
2077
2078bool HandleMappedPackageInfo(
2079 cmExportSet& exportSet, cm::string_view directive, Helper& helper,
2080 cmInstallCommandArguments const& installCommandArgs,
2081 cmExecutionStatus& status, cmInstallGenerator::MessageLevel message,
2082 std::string const& cxxModulesDirectory)
2083{
2084 cmPackageInfoArguments arguments;
2085
2086 // Extract information from the directive.
2087 std::string::size_type const n = directive.find('/');
2088 if (n != std::string::npos) {
2089 arguments.PackageName = std::string{ directive.substr(0, n) };
2090 directive = directive.substr(n + 1);
2091
2092 if (!directive.empty() && directive[0] == 'l') {
2093 arguments.LowerCase = true;
2094 directive = directive.substr(1);
2095 }
2096
2097 if (!directive.empty() && directive[0] == 'a') {
2098 std::string::size_type const d = directive.find('/');
2099 if (d != std::string::npos) {
2100 arguments.Appendix = std::string{ directive.substr(1, d - 1) };
2101 directive = directive.substr(d);
2102 } else {
2103 arguments.Appendix = std::string{ directive.substr(1) };
2104 directive = {};
2105 }
2106
2107 if (arguments.Appendix.empty()) {
2108 status.SetError(cmStrCat(
2109 "CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO given APPENDIX "
2110 R"(directive for export ")"_s,
2111 exportSet.GetName(), R"(", but no appendix name was provided.)"_s));
2112 return false;
2113 }
2114 }
2115
2116 if (!directive.empty()) {
2117 if (directive[0] != '/') {
2118 status.SetError(
2119 cmStrCat("CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO given unrecognized "
2120 R"(directive ")"_s,
2121 directive, R"(".)"_s));
2122 return false;
2123 }
2124
2125 directive = directive.substr(1);
2126 }
2127 } else {
2128 arguments.PackageName = std::string{ directive };
2129 directive = {};
2130 }
2131
2132 if (arguments.PackageName.empty()) {
2133 status.SetError(
2134 cmStrCat("CMAKE_INSTALL_EXPORTS_AS_PACKAGE_INFO missing package name "
2135 R"(for export ")"_s,

Callers 1

HandleExportModeFunction · 0.85

Calls 15

moveFunction · 0.85
GetLibraryDestinationMethod · 0.80
GetPermissionsMethod · 0.80
cmStrCatFunction · 0.70
findMethod · 0.45
substrMethod · 0.45
emptyMethod · 0.45
SetErrorMethod · 0.45
GetNameMethod · 0.45
GetDefaultDestinationMethod · 0.45
CheckMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…