瀏覽代碼

Remove unused DumpDocumentation code

The DumpDocumentation executable and some supporting code and tests were
completely unused by CMake.  Generation of documentation is done by the
individual executables with --help* options.  In this commit we simply
remove the unused code, executable, and test.
Brad King 16 年之前
父節點
當前提交
1d91bc64aa
共有 5 個文件被更改,包括 0 次插入196 次删除
  1. 0 2
      Source/CMakeLists.txt
  2. 0 150
      Source/cmDumpDocumentation.cxx
  3. 0 28
      Source/cmake.cxx
  4. 0 6
      Source/cmake.h
  5. 0 10
      Tests/CommandLineTest/CMakeLists.txt

+ 0 - 2
Source/CMakeLists.txt

@@ -459,8 +459,6 @@ ENDIF(APPLE)
 # Build CMake executable
 ADD_EXECUTABLE(cmake cmakemain.cxx)
 TARGET_LINK_LIBRARIES(cmake CMakeLib)
-ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
-TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib)
 
 # Build special executable for running programs on Windows 98
 IF(WIN32)

+ 0 - 150
Source/cmDumpDocumentation.cxx

@@ -1,150 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-// Program extracts documentation describing commands from
-// the CMake system.
-// 
-#include "cmake.h"
-
-#include "cmDocumentation.h"
-#include "cmVersion.h"
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationName[][3] =
-{
-  {0,
-   "  DumpDocumentation - Dump documentation for CMake.", 0},
-  {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationUsage[][3] =
-{
-  {0,
-   "  DumpDocumentation [filename]", 0},
-  {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationDescription[][3] =
-{
-  {0,
-   "The \"DumpDocumentation\" executable is only available in the build "
-   "tree.  It is used for testing, coverage, and documentation.", 0},
-  CMAKE_STANDARD_INTRODUCTION,
-  {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationOptions[][3] =
-{
-  {"--all-for-coverage", 
-   "Dump all documentation to stdout.  For testing.", 0},
-  {0,0,0}
-};
-
-
-int DumpHTML(const char* outname)
-{
-  std::ofstream fout(outname);
-  if(!fout)
-    {
-    std::cerr << "failed to open output file: " << outname << "\n";  
-    cmSystemTools::ReportLastSystemError("");
-    return -1;
-    }
-
-  cmake cmi;
-  cmDocumentation doc;
-  std::vector<cmDocumentationEntry> commands;
-  cmi.GetCommandDocumentation(commands);
-  cmOStringStream str;
-  str << "Documentation for Commands of CMake " 
-    << cmVersion::GetCMakeVersion();
-  doc.SetSection(str.str().c_str(), commands);
-  doc.Print(cmDocumentation::HTMLForm, fout);
-  
-  return 0;
-}
-
-int DumpForCoverageToStream(std::ostream& out)
-{
-  cmake cmi;
-  cmDocumentation doc;
-  std::vector<cmDocumentationEntry> commands;
-  std::vector<cmDocumentationEntry> generators;
-  cmi.GetCommandDocumentation(commands);
-  cmi.GetGeneratorDocumentation(generators);
-  doc.SetSection("Name",cmDocumentationName);
-  doc.SetSection("Usage",cmDocumentationUsage);
-  doc.SetSection("Description",cmDocumentationDescription);
-  doc.SetSection("options",cmDocumentationOptions);
-  doc.SetSection("Commands",commands);
-  doc.SetSection("Generators",generators);
-  doc.PrintDocumentation(cmDocumentation::Usage, out);
-  doc.PrintDocumentation(cmDocumentation::Full, out);
-  return 0;
-}
-
-int DumpForCoverage(const char* outname)
-{
-  if(outname)
-    {
-    std::ofstream fout(outname);
-    if(!fout)
-      {
-      std::cerr << "failed to open output file: " << outname << "\n";
-      cmSystemTools::ReportLastSystemError("");
-      return -1;
-      }
-    return DumpForCoverageToStream(fout);
-    }
-  else
-    {
-    return DumpForCoverageToStream(std::cout);
-    }
-}
-
-int main(int ac, char** av)
-{
-  cmSystemTools::EnableMSVCDebugHook();
-  cmSystemTools::FindExecutableDirectory(av[0]);
-  const char* outname = "cmake.html";
-  bool coverage = false;
-  if(ac > 1)
-    {
-    if(strcmp(av[1], "--all-for-coverage") == 0)
-      {
-      coverage = true;
-      if(ac > 2)
-        {
-        outname = av[2];
-        }
-      else
-        {
-        outname = 0;
-        }
-      }
-    else
-      {
-      outname = av[1];
-      }
-    }
-  
-  if(coverage)
-    {
-    return DumpForCoverage(outname);
-    }
-  else
-    {
-    return DumpHTML(outname);
-    }
-}

+ 0 - 28
Source/cmake.cxx

@@ -2322,34 +2322,6 @@ const char* cmake::GetCacheDefinition(const char* name) const
   return this->CacheManager->GetCacheValue(name);
 }
 
-int cmake::DumpDocumentationToFile(std::ostream& f)
-{
-#ifdef CMAKE_BUILD_WITH_CMAKE
-  // Loop over all registered commands and print out documentation
-  const char *name;
-  const char *terse;
-  const char *full;
-  char tmp[1024];
-  sprintf(tmp,"Version %s", cmVersion::GetCMakeVersion());
-  f << "<html>\n";
-  f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n";
-  f << "<ul>\n";
-  for(RegisteredCommandsMap::iterator j = this->Commands.begin();
-      j != this->Commands.end(); ++j)
-    {
-    name = (*j).second->GetName();
-    terse = (*j).second->GetTerseDocumentation();
-    full = (*j).second->GetFullDocumentation();
-    f << "<li><b>" << name << "</b> - " << terse << std::endl
-      << "<br><i>Usage:</i> " << full << "</li>" << std::endl << std::endl;
-    }
-  f << "</ul></html>\n";
-#else
-  (void)f;
-#endif
-  return 1;
-}
-
 void cmake::AddDefaultCommands()
 {
   std::list<cmCommand*> commands;

+ 0 - 6
Source/cmake.h

@@ -122,12 +122,6 @@ class cmake
     }
   //@}
 
-  /**
-   * Dump documentation to a file. If 0 is returned, the
-   * operation failed.
-   */
-  int DumpDocumentationToFile(std::ostream&);
-
   /**
    * Handle a command line invocation of cmake.
    */

+ 0 - 10
Tests/CommandLineTest/CMakeLists.txt

@@ -2,7 +2,6 @@ cmake_minimum_required (VERSION 2.6)
 PROJECT(CommandLineTest)
 
 GET_FILENAME_COMPONENT(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH)
-FIND_PROGRAM(DUMP_DOC_EXE NAMES DumpDocumentation PATHS ${CMAKE_BIN_DIR})
 MACRO(EXEC_CMAKE_COMMAND CMAKE_ARGS)
   EXEC_PROGRAM("${CMAKE_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET)
   IF(${RET})
@@ -25,15 +24,6 @@ EXEC_CMAKE_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/cmake.html\"")
 EXEC_CMAKE_COMMAND("--copyright \"${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt\"")
 EXEC_CMAKE_COMMAND("--version \"${CMAKE_CURRENT_BINARY_DIR}/version.txt\"")
 
-IF(DUMP_DOC_EXE)
-  EXEC_PROGRAM(${DUMP_DOC_EXE} ARGS "--all-for-coverage \"${CMAKE_CURRENT_BINARY_DIR}/all_for_coverage.txt\"" RETURN_VALUE RET)
-  IF(${RET})
-    MESSAGE(SEND_ERROR "DumpDoc command failed ")
-  ENDIF(${RET})
-ELSE(DUMP_DOC_EXE)
-  MESSAGE(SEND_ERROR "Cannot find DumpDocumentation executable.")
-ENDIF(DUMP_DOC_EXE)
-
 ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx)
 
 GET_FILENAME_COMPONENT(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH)