Browse Source

Include directories under Win32 only (inherited by subdirs)

Geoffrey Cross 25 years ago
parent
commit
8c4795025f

+ 2 - 0
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<cmCommand*>& 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);

+ 42 - 0
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<std::string>& args)
+{
+ if(args.size() < 1 )
+    {
+    this->SetError("called with incorrect number of arguments");
+    return false;
+    }
+  for(std::vector<std::string>::iterator i = args.begin();
+      i != args.end(); ++i)
+    {
+    m_Makefile->AddIncludeDirectory((*i).c_str());
+    }
+  return true;
+}
+

+ 83 - 0
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<std::string>& 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