blob: 28448b1175f399c86c73c149e2a9cb0112c0794c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*=========================================================================
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.
=========================================================================*/
/**
* cmCollectFlags - collect flags from CMakeLists.txt files.
* This class collects include and link flags from a CMakeLists.txt
* file and any CMakeLists.txt files above it in the directory tree.
* It stops searching wen the home directory is found.
*/
#ifndef cmCollectFlags_h
#define cmCollectFlags_h
#include <vector>
#include <string>
class cmMakefile;
class cmCollectFlags
{
public:
cmCollectFlags();
~cmCollectFlags ();
/**
* Set the home directory for the source code.
*/
void SetSourceHomeDirectory(const char* dir);
/**
* Set the start directory to look for flags
*/
void SetStartDirectory(const char* dir);
/**
* Parse the directory and all of it's parents for config
* information
*/
void ParseDirectories();
/**
* Print to standard out
*/
void Print();
/**
* Expance varibles for home and binary root in the collected flags.
* CMAKE_BINARY_DIR and CMAKE_SOURCE_ROOT are replaced with
* makefile->GetOutputHomeDirectory() and
* makefile->GetHomeDirectory()
*/
void ExpandVaribles(cmMakefile* makefile);
std::vector<std::string>& GetIncludeDirectories()
{
return m_IncludeDirectories;
}
std::vector<std::string>& GetLinkDirectories()
{
return m_LinkDirectories;
}
std::vector<std::string>& GetLinkLibraries()
{
return m_LinkLibraries;
}
std::vector<std::string>& GetLinkLibrariesWin32()
{
return m_LinkLibrariesWin32;
}
std::vector<std::string>& GetLinkLibrariesUnix()
{
return m_LinkLibrariesUnix;
}
private:
/**
* Look for CMakeLists.txt files to parse in dir,
* then in dir's parents, until the SourceHome directory
* is found.
*/
void ParseDirectory(const char* dir);
/**
* Parse a file for includes links and libs
*/
void ParseFile(const char* dir);
std::string m_SourceHomeDirectory; // source code top level dir
std::string m_StartDirectory; // source code sub directory
std::vector<std::string> m_IncludeDirectories;
std::vector<std::string> m_LinkDirectories;
std::vector<std::string> m_LinkLibraries;
std::vector<std::string> m_LinkLibrariesWin32;
std::vector<std::string> m_LinkLibrariesUnix;
};
#endif
|