Browse Source

new commands

Ken Martin 25 years ago
parent
commit
2bba34959c

+ 36 - 0
Source/cmBuildSharedLibrariesCommand.cxx

@@ -0,0 +1,36 @@
+/*=========================================================================
+
+  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 "cmBuildSharedLibrariesCommand.h"
+
+// cmBuildSharedLibrariesCommand
+bool cmBuildSharedLibrariesCommand::Invoke(std::vector<std::string>& args)
+{
+  // Now check and see if the value has been stored in the cache
+  // already, if so use that value and don't look for the program
+  const char* cacheValue
+    = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
+  if(!cacheValue)
+    {
+    cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS","0",
+                                                 cmCacheManager::BOOL);
+    m_Makefile->AddDefinition("BUILD_SHARED_LIBS", "0");
+    }
+  else
+    {
+    m_Makefile->AddDefinition("BUILD_SHARED_LIBS", cacheValue);
+    }
+  return true;
+}

+ 64 - 0
Source/cmBuildSharedLibrariesCommand.h

@@ -0,0 +1,64 @@
+#ifndef cmBuildSharedLibrariesCommand_h
+#define cmBuildSharedLibrariesCommand_h
+
+#include "cmStandardIncludes.h"
+#include "cmCommand.h"
+
+/** \class cmBuildSharedLibrariesCommand
+ * \brief Define a command that searches for an include file.
+ *
+ * cmBuildSharedLibrariesCommand is used to define a CMake variable include
+ * path location by specifying a file and list of directories.
+ */
+class cmBuildSharedLibrariesCommand : public cmCommand
+{
+public:
+  /**
+   * This is a virtual constructor for the command.
+   */
+  virtual cmCommand* Clone() 
+    {
+    return new cmBuildSharedLibrariesCommand;
+    }
+
+  /**
+   * 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 "BUILD_SHARED_LIBRARIES";}
+
+  /**
+   * Succinct documentation.
+   */
+  virtual const char* GetTerseDocumentation() 
+    {
+    return "Build shared libraries instead of static";
+    }
+  
+  /**
+   * More documentation.
+   */
+  virtual const char* GetFullDocumentation()
+    {
+    return
+      "BUILD_SHARED_LIBRARIES()";
+    }
+  
+private:
+};
+
+
+
+#endif

+ 41 - 0
Source/cmWrapExcludeFilesCommand.cxx

@@ -0,0 +1,41 @@
+/*=========================================================================
+
+  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 "cmWrapExcludeFilesCommand.h"
+
+// cmWrapExcludeFilesCommand
+bool cmWrapExcludeFilesCommand::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 j = args.begin();
+      j != args.end(); ++j)
+    {   
+    std::vector<cmClassFile>& Classes = m_Makefile->GetClasses();
+    for(unsigned int i = 0; i < Classes.size(); i++)
+      {
+      if(Classes[i].m_ClassName == (*j))
+        {
+        Classes[i].m_WrapExclude = true;
+        break;
+        }
+      }
+    }
+  return true;
+}
+

+ 63 - 0
Source/cmWrapExcludeFilesCommand.h

@@ -0,0 +1,63 @@
+/*=========================================================================
+
+  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 cmWrapExcludeFilesCommand_h
+#define cmWrapExcludeFilesCommand_h
+
+#include "cmStandardIncludes.h"
+#include "cmCommand.h"
+
+class cmWrapExcludeFilesCommand : public cmCommand
+{
+public:
+  virtual cmCommand* Clone() 
+    {
+      return new cmWrapExcludeFilesCommand;
+    }
+
+  /**
+   * This is called when the command is first encountered in
+   * the input file.
+   */
+  virtual bool Invoke(std::vector<std::string>& args);
+
+  /**
+   * The name of the command as specified in CMakeList.txt.
+   */
+  virtual const char* GetName() { return "WRAP_EXCLUDE_FILES";}
+
+  /**
+   * Succinct documentation.
+   */
+  virtual const char* GetTerseDocumentation() 
+    {
+    return "A list of classes, to exclude from wrapping.";
+    }
+  
+  /**
+   * Longer documentation.
+   */
+  virtual const char* GetFullDocumentation()
+    {
+      return
+        "WRAP_EXCLUDE_FILES(file1 file2 ..)";
+    }
+  
+  cmTypeMacro(cmWrapExcludeFilesCommand, cmCommand);
+};
+
+
+
+#endif