cmake/Source/cmSetDirectoryPropertiesCommand.cxx

40 lines
1.2 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetDirectoryPropertiesCommand.h"
2020-02-01 23:06:01 +01:00
#include "cmExecutionStatus.h"
2017-04-14 19:02:05 +02:00
#include "cmMakefile.h"
// cmSetDirectoryPropertiesCommand
2020-02-01 23:06:01 +01:00
bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
2016-10-30 18:24:19 +01:00
if (args.empty()) {
2020-02-01 23:06:01 +01:00
status.SetError("called with incorrect number of arguments");
return false;
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
2020-08-30 11:54:41 +02:00
// PROPERTIES followed by prop value pairs
if (args.size() % 2 != 1) {
status.SetError("Wrong number of arguments");
return false;
2016-07-09 11:21:54 +02:00
}
2020-08-30 11:54:41 +02:00
for (auto iter = args.begin() + 1; iter != args.end(); iter += 2) {
const std::string& prop = *iter;
2016-07-09 11:21:54 +02:00
if (prop == "VARIABLES") {
2020-08-30 11:54:41 +02:00
status.SetError(
"Variables and cache variables should be set using SET command");
return false;
2016-10-30 18:24:19 +01:00
}
if (prop == "MACROS") {
2020-08-30 11:54:41 +02:00
status.SetError(
"Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
return false;
}
2020-08-30 11:54:41 +02:00
status.GetMakefile().SetProperty(prop, (iter + 1)->c_str());
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
return true;
}