packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmTargetCompileOptionsCommand.cxx
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2013 Stephen Kelly <steveire@gmail.com>
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
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 "cmTargetCompileOptionsCommand.h"
13
14 bool cmTargetCompileOptionsCommand
15 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
16 {
17   return this->HandleArguments(args, "COMPILE_OPTIONS", PROCESS_BEFORE);
18 }
19
20 void cmTargetCompileOptionsCommand
21 ::HandleImportedTarget(const std::string &tgt)
22 {
23   cmOStringStream e;
24   e << "Cannot specify compile options for imported target \""
25     << tgt << "\".";
26   this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
27 }
28
29 void cmTargetCompileOptionsCommand
30 ::HandleMissingTarget(const std::string &name)
31 {
32   cmOStringStream e;
33   e << "Cannot specify compile options for target \"" << name << "\" "
34        "which is not built by this project.";
35   this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
36 }
37
38 //----------------------------------------------------------------------------
39 std::string cmTargetCompileOptionsCommand
40 ::Join(const std::vector<std::string> &content)
41 {
42   std::string defs;
43   std::string sep;
44   for(std::vector<std::string>::const_iterator it = content.begin();
45     it != content.end(); ++it)
46     {
47     defs += sep + *it;
48     sep = ";";
49     }
50   return defs;
51 }
52
53 //----------------------------------------------------------------------------
54 void cmTargetCompileOptionsCommand
55 ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
56                                    bool, bool)
57 {
58   cmListFileBacktrace lfbt;
59   this->Makefile->GetBacktrace(lfbt);
60   cmValueWithOrigin entry(this->Join(content), lfbt);
61   tgt->InsertCompileOption(entry);
62 }