cmMakefile.h 3.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile$
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) 2000 National Library of Medicine
  All rights reserved.

  See COPYRIGHT.txt for copyright details.

=========================================================================*/
/**
17
18
 * cmMakefile - used to parse and store the contents of a
 * CMakeLists.txt makefile in memory.
19
20
21
22
23
24
25
26
 */
#ifndef cmMakefile_h
#define cmMakefile_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif

#include "cmClassFile.h"
27
#include "cmCollectFlags.h"
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <vector>
#include <fstream>
#include <iostream>

class cmMakefile
{
public:
  cmMakefile();
  // Parse a Makfile.in file
  bool ReadMakefile(const char* makefile); 
  // Print useful stuff to stdout
  void Print();
  // Set the home directory for the project
  void SetHomeDirectory(const char* dir) 
    {
      m_cmHomeDirectory = dir;
    }
  const char* GetHomeDirectory() 
    {
      return m_cmHomeDirectory.c_str();
    }
  // Set the current directory in the project
  void SetCurrentDirectory(const char* dir) 
    {
      m_cmCurrentDirectory = dir;
    }
  const char* GetCurrentDirectory() 
    {
      return m_cmCurrentDirectory.c_str();
    }
  // Set the name of the library that is built by this makefile
  void SetLibraryName(const char* lib)
    {
      m_LibraryName = lib;
    }
  const char* GetLibraryName()
    {
      return m_LibraryName.c_str();
    }
67
68
69
70
71
72
73
74
75
  // Set the name of the library that is built by this makefile
  void SetProjectName(const char* lib)
    {
      m_ProjectName = lib;
    }
  const char* GetProjectName()
    {
      return m_ProjectName.c_str();
    }
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  
  // Set the name of the library that is built by this makefile
  void SetOutputDirectory(const char* lib)
    {
      m_OutputDirectory = lib;
    }
  const char* GetOutputDirectory()
    {
      return m_OutputDirectory.c_str();
    }
  
  // Set the name of the library that is built by this makefile
  void SetOutputHomeDirectory(const char* lib)
    {
      m_OutputHomeDirectory = lib;
    }
  const char* GetOutputHomeDirectory()
    {
      return m_OutputHomeDirectory.c_str();
    }
96
97
98
99
100
101
102
103
  cmCollectFlags& GetBuildFlags() 
    {
      return m_BuildFlags;
    }
  const std::vector<std::string>& GetSubDirectories()
    { 
      return m_SubDirectories;
    }
104
  
105
106
107
108
109
  bool HasExecutables() 
    {
      return m_Executables;
    }
  
110
private:
111
  void ReadTemplateInstanceDirectory(std::string&);
112
113
114
115
116
117
  void ReadClasses(std::ifstream& fin, bool t);
  friend class cmMakeDepend;	// make depend needs direct access 
				// to the m_Classes array
protected:
  bool m_Executables;
  std::string m_Prefix;
118
  std::vector<std::string> m_TemplateDirectories; // Template directory name if found in file
119
120
121
122
123
  std::string m_OutputDirectory; // Current output directory for makefile
  std::string m_OutputHomeDirectory; // Top level output directory
  std::string m_cmHomeDirectory; // Home directory for source
  std::string m_cmCurrentDirectory; // current directory in source
  std::string m_LibraryName;	// library name
124
  std::string m_ProjectName;	// project name
125
126
  std::vector<cmClassFile> m_Classes; // list of classes in makefile
  std::vector<std::string> m_SubDirectories; // list of sub directories
127
128
  std::vector<std::string> m_MakeVerbatim; // lines copied from input file
  cmCollectFlags m_BuildFlags;
129
130
131
132
};


#endif