2000-08-29 19:26:29 +00:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
/**
|
2000-09-12 09:30:35 +00:00
|
|
|
* cmMakefile - used to parse and store the contents of a
|
|
|
|
* CMakeLists.txt makefile in memory.
|
2000-08-29 19:26:29 +00:00
|
|
|
*/
|
|
|
|
#ifndef cmMakefile_h
|
|
|
|
#define cmMakefile_h
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning ( disable : 4786 )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cmClassFile.h"
|
2000-09-12 09:30:35 +00:00
|
|
|
#include "cmCollectFlags.h"
|
2000-08-29 19:26:29 +00:00
|
|
|
#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();
|
|
|
|
}
|
2000-09-27 19:01:19 +00:00
|
|
|
// 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();
|
|
|
|
}
|
2000-08-29 19:26:29 +00:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
}
|
2000-09-12 09:30:35 +00:00
|
|
|
cmCollectFlags& GetBuildFlags()
|
|
|
|
{
|
|
|
|
return m_BuildFlags;
|
|
|
|
}
|
|
|
|
const std::vector<std::string>& GetSubDirectories()
|
|
|
|
{
|
|
|
|
return m_SubDirectories;
|
|
|
|
}
|
2000-08-29 19:26:29 +00:00
|
|
|
|
2000-09-27 19:01:19 +00:00
|
|
|
bool HasExecutables()
|
|
|
|
{
|
|
|
|
return m_Executables;
|
|
|
|
}
|
|
|
|
|
2000-08-29 19:26:29 +00:00
|
|
|
private:
|
2000-08-30 17:35:41 +00:00
|
|
|
void ReadTemplateInstanceDirectory(std::string&);
|
2000-08-29 19:26:29 +00:00
|
|
|
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;
|
2000-09-21 17:45:08 +00:00
|
|
|
std::vector<std::string> m_TemplateDirectories; // Template directory name if found in file
|
2000-08-29 19:26:29 +00:00
|
|
|
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
|
2000-09-27 19:01:19 +00:00
|
|
|
std::string m_ProjectName; // project name
|
2000-08-29 19:26:29 +00:00
|
|
|
std::vector<cmClassFile> m_Classes; // list of classes in makefile
|
|
|
|
std::vector<std::string> m_SubDirectories; // list of sub directories
|
2000-09-12 09:30:35 +00:00
|
|
|
std::vector<std::string> m_MakeVerbatim; // lines copied from input file
|
|
|
|
cmCollectFlags m_BuildFlags;
|
2000-08-29 19:26:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|