1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2013 Stephen Kelly <steveire@gmail.com>
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmTargetCompileDefinitionsCommand.h"
14 bool cmTargetCompileDefinitionsCommand
15 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
17 return this->HandleArguments(args, "COMPILE_DEFINITIONS");
20 void cmTargetCompileDefinitionsCommand
21 ::HandleImportedTarget(const std::string &tgt)
24 e << "Cannot specify compile definitions for imported target \""
26 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
29 void cmTargetCompileDefinitionsCommand
30 ::HandleMissingTarget(const std::string &name)
33 e << "Cannot specify compile definitions for target \"" << name << "\" "
34 "which is not built by this project.";
35 this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
38 //----------------------------------------------------------------------------
39 std::string cmTargetCompileDefinitionsCommand
40 ::Join(const std::vector<std::string> &content)
44 for(std::vector<std::string>::const_iterator it = content.begin();
45 it != content.end(); ++it)
47 if (strncmp(it->c_str(), "-D", 2) == 0)
49 defs += sep + it->substr(2);
60 //----------------------------------------------------------------------------
61 void cmTargetCompileDefinitionsCommand
62 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
65 tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());