ENH: Added INCLUDE_REGULAR_EXPRESSION command to set regular expression used in dependency checking.
This commit is contained in:
parent
b9a8948ec8
commit
be4db9150c
|
@ -41,6 +41,7 @@
|
||||||
#include "cmWrapTclCommand.cxx"
|
#include "cmWrapTclCommand.cxx"
|
||||||
#include "cmBuildSharedLibrariesCommand.cxx"
|
#include "cmBuildSharedLibrariesCommand.cxx"
|
||||||
#include "cmUtilitySourceCommand.cxx"
|
#include "cmUtilitySourceCommand.cxx"
|
||||||
|
#include "cmIncludeRegularExpressionCommand.cxx"
|
||||||
|
|
||||||
void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +80,7 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
||||||
commands.push_back(new cmWrapTclCommand);
|
commands.push_back(new cmWrapTclCommand);
|
||||||
commands.push_back(new cmBuildSharedLibrariesCommand);
|
commands.push_back(new cmBuildSharedLibrariesCommand);
|
||||||
commands.push_back(new cmUtilitySourceCommand);
|
commands.push_back(new cmUtilitySourceCommand);
|
||||||
|
commands.push_back(new cmIncludeRegularExpressionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
=========================================================================*/
|
||||||
|
#include "cmIncludeRegularExpressionCommand.h"
|
||||||
|
|
||||||
|
// cmIncludeRegularExpressionCommand
|
||||||
|
bool cmIncludeRegularExpressionCommand::Invoke(std::vector<std::string>& args)
|
||||||
|
{
|
||||||
|
if(args.size() != 1)
|
||||||
|
{
|
||||||
|
this->SetError("called with incorrect number of arguments");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Makefile->SetIncludeRegularExpression(args[0].c_str());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
=========================================================================*/
|
||||||
|
#ifndef cmIncludeRegularExpressionCommand_h
|
||||||
|
#define cmIncludeRegularExpressionCommand_h
|
||||||
|
|
||||||
|
#include "cmStandardIncludes.h"
|
||||||
|
#include "cmCommand.h"
|
||||||
|
|
||||||
|
/** \class cmIncludeRegularExpressionCommand
|
||||||
|
* \brief Set the regular expression for following #includes.
|
||||||
|
*
|
||||||
|
* cmIncludeRegularExpressionCommand is used to specify the regular expression
|
||||||
|
* used by cmMakeDepend to determine whether to follow a #include file in
|
||||||
|
* dependency checking.
|
||||||
|
*/
|
||||||
|
class cmIncludeRegularExpressionCommand : public cmCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* This is a virtual constructor for the command.
|
||||||
|
*/
|
||||||
|
virtual cmCommand* Clone()
|
||||||
|
{
|
||||||
|
return new cmIncludeRegularExpressionCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the command is first encountered in
|
||||||
|
* the CMakeLists.txt file.
|
||||||
|
*/
|
||||||
|
virtual bool Invoke(std::vector<std::string>& args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
*/
|
||||||
|
virtual const char* GetName() {return "INCLUDE_REGULAR_EXPRESSION";}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This determines if the command gets propagated down
|
||||||
|
* to makefiles located in subdirectories.
|
||||||
|
*/
|
||||||
|
virtual bool IsInherited()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Succinct documentation.
|
||||||
|
*/
|
||||||
|
virtual const char* GetTerseDocumentation()
|
||||||
|
{
|
||||||
|
return "Set the regular expression used for dependency checking.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More documentation.
|
||||||
|
*/
|
||||||
|
virtual const char* GetFullDocumentation()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
"INCLUDE_REGULAR_EXPRESSION(regex)\n"
|
||||||
|
"Sets the regular expression used in dependency checking. Only\n"
|
||||||
|
"include files matching this regular expression will be traced.";
|
||||||
|
}
|
||||||
|
|
||||||
|
cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,14 +20,7 @@
|
||||||
cmMakeDepend::cmMakeDepend()
|
cmMakeDepend::cmMakeDepend()
|
||||||
{
|
{
|
||||||
m_Verbose = false;
|
m_Verbose = false;
|
||||||
m_IncludeFileRegularExpression.compile("^itk|^vtk|^vnl|^vcl|^f2c");
|
m_IncludeFileRegularExpression.compile("");
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// only files matching this regular expression with be considered
|
|
||||||
void cmMakeDepend::SetIncludeRegularExpression(const char* prefix)
|
|
||||||
{
|
|
||||||
m_IncludeFileRegularExpression.compile(prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +42,10 @@ cmMakeDepend::~cmMakeDepend()
|
||||||
void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
||||||
{
|
{
|
||||||
m_Makefile = makefile;
|
m_Makefile = makefile;
|
||||||
|
|
||||||
|
// Now extract the include file regular expression from the makefile.
|
||||||
|
m_IncludeFileRegularExpression.compile(
|
||||||
|
m_Makefile->m_IncludeFileRegularExpression.c_str());
|
||||||
|
|
||||||
// Now extract any include paths from the makefile flags
|
// Now extract any include paths from the makefile flags
|
||||||
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
||||||
|
|
|
@ -103,12 +103,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void DoDepends();
|
void DoDepends();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a regular expression that include files must match
|
|
||||||
* in order to be considered as part of the depend information.
|
|
||||||
*/
|
|
||||||
void SetIncludeRegularExpression(const char* regex);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a directory to the search path for include files.
|
* Add a directory to the search path for include files.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
// default is not to be building executables
|
// default is not to be building executables
|
||||||
cmMakefile::cmMakefile()
|
cmMakefile::cmMakefile()
|
||||||
{
|
{
|
||||||
|
// Setup the default include file regular expression.
|
||||||
|
m_IncludeFileRegularExpression = "^itk|^vtk|^vnl|^vcl|^f2c";
|
||||||
|
|
||||||
m_DefineFlags = " ";
|
m_DefineFlags = " ";
|
||||||
m_MakefileGenerator = 0;
|
m_MakefileGenerator = 0;
|
||||||
this->AddDefaultCommands();
|
this->AddDefaultCommands();
|
||||||
|
|
|
@ -246,7 +246,16 @@ public:
|
||||||
return m_CurrentOutputDirectory.c_str();
|
return m_CurrentOutputDirectory.c_str();
|
||||||
}
|
}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a regular expression that include files must match
|
||||||
|
* in order to be considered as part of the depend information.
|
||||||
|
*/
|
||||||
|
void SetIncludeRegularExpression(const char* regex)
|
||||||
|
{
|
||||||
|
m_IncludeFileRegularExpression = regex;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the name of the library that is built by this makefile.
|
* Specify the name of the library that is built by this makefile.
|
||||||
*/
|
*/
|
||||||
|
@ -429,6 +438,7 @@ protected:
|
||||||
std::vector<std::string> m_LinkLibraries;
|
std::vector<std::string> m_LinkLibraries;
|
||||||
std::vector<std::string> m_LinkLibrariesWin32;
|
std::vector<std::string> m_LinkLibrariesWin32;
|
||||||
std::vector<std::string> m_LinkLibrariesUnix;
|
std::vector<std::string> m_LinkLibrariesUnix;
|
||||||
|
std::string m_IncludeFileRegularExpression;
|
||||||
std::string m_DefineFlags;
|
std::string m_DefineFlags;
|
||||||
std::vector<customCommand> m_CustomCommands;
|
std::vector<customCommand> m_CustomCommands;
|
||||||
typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
|
typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
|
||||||
|
|
Loading…
Reference in New Issue