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

Method cmInstallCommandArguments

Source/cmInstallCommandArguments.cxx:30–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28std::string const cmInstallCommandArguments::EmptyString;
29
30cmInstallCommandArguments::cmInstallCommandArguments(
31 std::string defaultComponent, cmMakefile& makefile)
32 : DefaultComponentName(std::move(defaultComponent))
33{
34 std::function<ArgumentParser::Continue(cm::string_view)> normalizeDest;
35
36 switch (makefile.GetPolicyStatus(cmPolicies::CMP0177)) {
37 case cmPolicies::OLD:
38 normalizeDest = [this](cm::string_view arg) -> ArgumentParser::Continue {
39 this->Destination = std::string(arg.begin(), arg.end());
40 return ArgumentParser::Continue::No;
41 };
42 break;
43 case cmPolicies::WARN:
44 normalizeDest =
45 [this, &makefile](cm::string_view arg) -> ArgumentParser::Continue {
46 this->Destination = std::string(arg.begin(), arg.end());
47 // We can't be certain if a warning is appropriate if there are any
48 // generator expressions
49 if (cmGeneratorExpression::Find(arg) == cm::string_view::npos &&
50 arg != cmCMakePath(arg).Normal().String()) {
51 makefile.IssueMessage(
52 MessageType::AUTHOR_WARNING,
53 cmPolicies::GetPolicyWarning(cmPolicies::CMP0177));
54 }
55 return ArgumentParser::Continue::No;
56 };
57 break;
58 case cmPolicies::NEW:
59 normalizeDest = [this](cm::string_view arg) -> ArgumentParser::Continue {
60 if (cmGeneratorExpression::Find(arg) == cm::string_view::npos) {
61 this->Destination = cmCMakePath(arg).Normal().String();
62 } else {
63 this->Destination =
64 cmStrCat("$<PATH:CMAKE_PATH,NORMALIZE,", arg, '>');
65 }
66 return ArgumentParser::Continue::No;
67 };
68 break;
69 }
70
71 this->Bind("DESTINATION"_s, normalizeDest);
72 this->Bind("COMPONENT"_s, this->Component);
73 this->Bind("NAMELINK_COMPONENT"_s, this->NamelinkComponent);
74 this->Bind("EXCLUDE_FROM_ALL"_s, this->ExcludeFromAll);
75 this->Bind("RENAME"_s, this->Rename);
76 this->Bind("PERMISSIONS"_s, this->Permissions);
77 this->Bind("CONFIGURATIONS"_s, this->Configurations);
78 this->Bind("OPTIONAL"_s, this->Optional);
79 this->Bind("NAMELINK_ONLY"_s, this->NamelinkOnly);
80 this->Bind("NAMELINK_SKIP"_s, this->NamelinkSkip);
81 this->Bind("TYPE"_s, this->Type);
82}
83
84std::string const& cmInstallCommandArguments::GetDestination() const
85{

Callers

nothing calls this directly

Calls 10

moveFunction · 0.85
cmCMakePathClass · 0.85
NormalMethod · 0.80
cmStrCatFunction · 0.70
GetPolicyStatusMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
StringMethod · 0.45
IssueMessageMethod · 0.45
BindMethod · 0.45

Tested by

no test coverage detected