diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index e62f3e9c6..f4abf326c 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -23,6 +23,7 @@ #include "cmUnixLibrariesCommand.cxx" #include "cmWin32DefinesCommand.cxx" #include "cmWin32LibrariesCommand.cxx" +#include "cmWin32IncludeDirectoryCommand.cxx" #include "cmConfigureFileNoAutoconf.cxx" #include "cmCableCommand.cxx" #include "cmCableData.cxx" @@ -63,6 +64,7 @@ void GetPredefinedCommands(std::list& commands) commands.push_back(new cmUnixLibrariesCommand); commands.push_back(new cmWin32DefinesCommand); commands.push_back(new cmWin32LibrariesCommand); + commands.push_back(new cmWin32IncludeDirectoryCommand); commands.push_back(new cmConfigureFileNoAutoconf); commands.push_back(new cmCableDefineSetCommand); commands.push_back(new cmCableOpenNamespaceCommand); diff --git a/Source/cmWin32IncludeDirectoryCommand.cxx b/Source/cmWin32IncludeDirectoryCommand.cxx new file mode 100644 index 000000000..c5958930a --- /dev/null +++ b/Source/cmWin32IncludeDirectoryCommand.cxx @@ -0,0 +1,42 @@ +/*========================================================================= + + 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 "cmWin32IncludeDirectoryCommand.h" +#include "cmCacheManager.h" + +// cmWin32IncludeDirectoryCommand +cmWin32IncludeDirectoryCommand::cmWin32IncludeDirectoryCommand() +{ +#ifndef _WIN32 + this->EnabledOff(); +#endif +} + + +bool cmWin32IncludeDirectoryCommand::Invoke(std::vector& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + m_Makefile->AddIncludeDirectory((*i).c_str()); + } + return true; +} + diff --git a/Source/cmWin32IncludeDirectoryCommand.h b/Source/cmWin32IncludeDirectoryCommand.h new file mode 100644 index 000000000..f2ee7e56c --- /dev/null +++ b/Source/cmWin32IncludeDirectoryCommand.h @@ -0,0 +1,83 @@ +/*========================================================================= + + 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 cmWin32IncludeDirectoryCommand_h +#define cmWin32IncludeDirectoryCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmWin32IncludeDirectoryCommand + * \brief Add Win32 include directories to the build. + * + * cmWin32IncludeDirectoryCommand is used to specify directory locations + * to search for included files under a Windows system. + */ +class cmWin32IncludeDirectoryCommand : public cmCommand +{ +public: + /** + * Constructor + */ + cmWin32IncludeDirectoryCommand(); + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmWin32IncludeDirectoryCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool Invoke(std::vector& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "WIN32_INCLUDE_DIRECTORIES";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add Win32 include directories to the build."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "WIN32_INCLUDE_DIRECTORIES(dir1 dir2 ...)"; + } + + cmTypeMacro(cmWin32IncludeDirectoryCommand, cmCommand); +}; + + + +#endif