cmTargetCompileFeaturesCommand.cxx 1.31 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4
#include "cmTargetCompileFeaturesCommand.h"

5 6
#include <sstream>

7
#include "cmAlgorithms.h"
8
#include "cmMakefile.h"
9
#include "cmMessageType.h"
10 11 12

class cmExecutionStatus;
class cmTarget;
13

14
bool cmTargetCompileFeaturesCommand::InitialPass(
15
  std::vector<std::string> const& args, cmExecutionStatus&)
16 17 18 19
{
  return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS);
}

20 21
void cmTargetCompileFeaturesCommand::HandleMissingTarget(
  const std::string& name)
22
{
23
  std::ostringstream e;
24 25
  e << "Cannot specify compile features for target \"" << name
    << "\" "
26
       "which is not built by this project.";
27
  this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
28 29
}

30 31
std::string cmTargetCompileFeaturesCommand::Join(
  const std::vector<std::string>& content)
32
{
33
  return cmJoin(content, ";");
34 35
}

36 37
bool cmTargetCompileFeaturesCommand::HandleDirectContent(
  cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
38
{
39
  for (std::string const& it : content) {
40
    std::string error;
41
    if (!this->Makefile->AddRequiredTargetFeature(tgt, it, &error)) {
42
      this->SetError(error);
43
      return false; // Not (successfully) handled.
44
    }
45
  }
46
  return true; // Successfully handled.
47
}