1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmGetCMakePropertyCommand.h"
7 #include "cmExecutionStatus.h"
8 #include "cmGlobalGenerator.h"
9 #include "cmMakefile.h"
11 #include "cmStringAlgorithms.h"
14 // cmGetCMakePropertyCommand
15 bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
16 cmExecutionStatus& status)
18 if (args.size() < 2) {
19 status.SetError("called with incorrect number of arguments");
23 std::string const& variable = args[0];
24 std::string output = "NOTFOUND";
26 if (args[1] == "VARIABLES") {
27 if (cmValue varsProp = status.GetMakefile().GetProperty("VARIABLES")) {
30 } else if (args[1] == "MACROS") {
32 if (cmValue macrosProp = status.GetMakefile().GetProperty("MACROS")) {
35 } else if (args[1] == "COMPONENTS") {
36 const std::set<std::string>* components =
37 status.GetMakefile().GetGlobalGenerator()->GetInstallComponents();
38 output = cmJoin(*components, ";");
40 cmValue prop = nullptr;
41 if (!args[1].empty()) {
42 prop = status.GetMakefile().GetState()->GetGlobalProperty(args[1]);
49 status.GetMakefile().AddDefinition(variable, output);