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

Function HandleExportMode

Source/cmInstallCommand.cxx:2187–2316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2185#endif
2186
2187bool HandleExportMode(std::vector<std::string> const& args,
2188 cmExecutionStatus& status)
2189{
2190 Helper helper(status);
2191
2192 // This is the EXPORT mode.
2193 cmInstallCommandArguments ica(helper.DefaultComponentName, *helper.Makefile);
2194
2195 std::string exp;
2196 std::string name_space;
2197 bool exportOld = false;
2198 std::string filename;
2199 std::string cxx_modules_directory;
2200 bool exportPackageDependencies = false;
2201
2202 ica.Bind("EXPORT"_s, exp);
2203 ica.Bind("NAMESPACE"_s, name_space);
2204 ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld);
2205 ica.Bind("FILE"_s, filename);
2206 ica.Bind("CXX_MODULES_DIRECTORY"_s, cxx_modules_directory);
2207
2208 if (cmExperimental::HasSupportEnabled(
2209 status.GetMakefile(),
2210 cmExperimental::Feature::ExportPackageDependencies)) {
2211 ica.Bind("EXPORT_PACKAGE_DEPENDENCIES"_s, exportPackageDependencies);
2212 }
2213
2214 std::vector<std::string> unknownArgs;
2215 ica.Parse(args, &unknownArgs);
2216
2217 if (!unknownArgs.empty()) {
2218 // Unknown argument.
2219 status.SetError(
2220 cmStrCat(args[0], " given unknown argument \"", unknownArgs[0], "\"."));
2221 return false;
2222 }
2223
2224 if (!ica.Finalize()) {
2225 return false;
2226 }
2227
2228 if (exp.empty()) {
2229 status.SetError(cmStrCat(args[0], " missing EXPORT."));
2230 return false;
2231 }
2232
2233 // Make sure there is a destination.
2234 if (ica.GetDestination().empty()) {
2235 // A destination is required.
2236 status.SetError(cmStrCat(args[0], " given no DESTINATION!"));
2237 return false;
2238 }
2239
2240 // Check the file name.
2241 std::string fname = filename;
2242 if (fname.find_first_of(":/\\") != std::string::npos) {
2243 status.SetError(cmStrCat(args[0], " given invalid export file name \"",
2244 fname,

Callers

nothing calls this directly

Calls 15

cmHasSuffixFunction · 0.85
MatchExportFunction · 0.85
HandleMappedPackageInfoFunction · 0.85
moveFunction · 0.85
find_first_ofMethod · 0.80
AddInstallComponentMethod · 0.80
GetPermissionsMethod · 0.80
cmStrCatFunction · 0.70
BindMethod · 0.45
GetMakefileMethod · 0.45
ParseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…