~ubuntu-branches/ubuntu/intrepid/cmake/intrepid-backports

« back to all changes in this revision

Viewing changes to Source/cmTarget.h

  • Committer: Bazaar Package Importer
  • Author(s): Maitland Bottoms
  • Date: 2002-02-14 18:36:25 UTC
  • Revision ID: james.westby@ubuntu.com-20020214183625-8m44isdas2k4l0f7
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   Insight Segmentation & Registration Toolkit
 
4
  Module:    $RCSfile: cmTarget.h,v $
 
5
  Language:  C++
 
6
  Date:      $Date: 2001/12/11 07:17:53 $
 
7
  Version:   $Revision: 1.18 $
 
8
 
 
9
Copyright (c) 2001 Insight Consortium
 
10
All rights reserved.
 
11
 
 
12
Redistribution and use in source and binary forms, with or without
 
13
modification, are permitted provided that the following conditions are met:
 
14
 
 
15
 * Redistributions of source code must retain the above copyright notice,
 
16
   this list of conditions and the following disclaimer.
 
17
 
 
18
 * Redistributions in binary form must reproduce the above copyright notice,
 
19
   this list of conditions and the following disclaimer in the documentation
 
20
   and/or other materials provided with the distribution.
 
21
 
 
22
 * The name of the Insight Consortium, nor the names of any consortium members,
 
23
   nor of any contributors, may be used to endorse or promote products derived
 
24
   from this software without specific prior written permission.
 
25
 
 
26
  * Modified source versions must be plainly marked as such, and must not be
 
27
    misrepresented as being the original software.
 
28
 
 
29
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
 
30
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
31
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
32
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
 
33
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
34
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
35
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
36
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
37
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
38
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
39
 
 
40
=========================================================================*/
 
41
#ifndef cmTarget_h
 
42
#define cmTarget_h
 
43
 
 
44
#include "cmStandardIncludes.h"
 
45
#include "cmCustomCommand.h"
 
46
#include "cmSourceFile.h"
 
47
 
 
48
/** \class cmTarget
 
49
 * \brief Represent a library or executable target loaded from a makefile.
 
50
 *
 
51
 * cmTarget represents a target loaded from 
 
52
 * a makefile.
 
53
 */
 
54
class cmTarget
 
55
{
 
56
public:
 
57
  enum TargetType { EXECUTABLE, WIN32_EXECUTABLE, STATIC_LIBRARY,
 
58
                    SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, INSTALL_FILES, 
 
59
                    INSTALL_PROGRAMS };
 
60
 
 
61
  /**
 
62
   * Return the type of target.
 
63
   */
 
64
  TargetType GetType() const
 
65
    {
 
66
      return m_TargetType;
 
67
    }
 
68
  
 
69
  void SetType(TargetType f) { m_TargetType = f; }
 
70
  
 
71
  /**
 
72
   * Indicate whether the target is part of the all target
 
73
   */
 
74
  bool IsInAll() const { return m_InAll; }
 
75
  bool GetInAll() const { return m_InAll; }
 
76
  void SetInAll(bool f) { m_InAll = f; }
 
77
 
 
78
  /**
 
79
   * Get the list of the custom commands for this target
 
80
   */
 
81
  const std::vector<cmCustomCommand> &GetCustomCommands() const {return m_CustomCommands;}
 
82
  std::vector<cmCustomCommand> &GetCustomCommands() {return m_CustomCommands;}
 
83
 
 
84
  /**
 
85
   * Get the list of the source lists used by this target
 
86
   */
 
87
  const std::vector<std::string> &GetSourceLists() const 
 
88
    {return m_SourceLists;}
 
89
  std::vector<std::string> &GetSourceLists() {return m_SourceLists;}
 
90
  
 
91
  /**
 
92
   * Get the list of the source files used by this target
 
93
   */
 
94
  const std::vector<cmSourceFile> &GetSourceFiles() const 
 
95
    {return m_SourceFiles;}
 
96
  std::vector<cmSourceFile> &GetSourceFiles() {return m_SourceFiles;}
 
97
 
 
98
  /**
 
99
   * Get the list of the source files used by this target
 
100
   */
 
101
  enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
 
102
  typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
 
103
  const LinkLibraries &GetLinkLibraries() const {return m_LinkLibraries;}
 
104
  LinkLibraries &GetLinkLibraries() {return m_LinkLibraries;}
 
105
 
 
106
  /**
 
107
   * Set the path where this target should be installed. This is relative to
 
108
   * INSTALL_PREFIX
 
109
   */
 
110
  std::string GetInstallPath() const {return m_InstallPath;}
 
111
  void SetInstallPath(const char *name) {m_InstallPath = name;}
 
112
  
 
113
  /**
 
114
   * Merge Link Libraries into this targets current list 
 
115
   */
 
116
  void MergeLibraries(const LinkLibraries &ll);
 
117
    
 
118
  /**
 
119
   * Generate the SourceFilesList from the SourceLists. This should only be
 
120
   * done once to be safe.  
 
121
   */
 
122
  void GenerateSourceFilesFromSourceLists(const cmMakefile &mf);
 
123
 
 
124
  /** Add a utility on which this project depends. A utility is an executable
 
125
   * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
 
126
   * commands. It is not a full path nor does it have an extension.  
 
127
   */
 
128
  void AddUtility(const char* u) { m_Utilities.insert(u);}
 
129
  ///! Get the utilities used by this target
 
130
  std::set<std::string>const& GetUtilities() const { return m_Utilities; }
 
131
 
 
132
private:
 
133
  std::vector<cmCustomCommand> m_CustomCommands;
 
134
  std::vector<std::string> m_SourceLists;
 
135
  TargetType m_TargetType;
 
136
  std::vector<cmSourceFile> m_SourceFiles;
 
137
  LinkLibraries m_LinkLibraries;
 
138
  bool m_InAll;
 
139
  std::string m_InstallPath;
 
140
  std::set<std::string> m_Utilities;
 
141
};
 
142
 
 
143
typedef std::map<cmStdString,cmTarget> cmTargets;
 
144
 
 
145
#endif