summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CPack/cpack.cxx28
-rw-r--r--Source/CursesDialog/ccmake.cxx24
-rw-r--r--Source/MFCDialog/CMakeSetup.cpp22
-rw-r--r--Source/cmDocumentVariables.cxx218
-rw-r--r--Source/cmDocumentation.cxx737
-rw-r--r--Source/cmDocumentation.h147
-rw-r--r--Source/cmDocumentationFormatter.h4
-rw-r--r--Source/cmDocumentationFormatterHTML.cxx61
-rw-r--r--Source/cmDocumentationFormatterHTML.h2
-rw-r--r--Source/cmDocumentationFormatterMan.cxx25
-rw-r--r--Source/cmDocumentationFormatterMan.h2
-rw-r--r--Source/cmDocumentationFormatterText.cxx30
-rw-r--r--Source/cmDocumentationFormatterText.h2
-rw-r--r--Source/cmDocumentationFormatterUsage.cxx27
-rw-r--r--Source/cmDocumentationFormatterUsage.h2
-rw-r--r--Source/cmDocumentationSection.cxx71
-rw-r--r--Source/cmDocumentationSection.h71
-rw-r--r--Source/cmDumpDocumentation.cxx22
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx6
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio8Win64Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx6
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx6
-rw-r--r--Source/cmMakefile.cxx20
-rw-r--r--Source/cmPropertyDefinition.cxx12
-rw-r--r--Source/cmPropertyDefinition.h10
-rw-r--r--Source/cmPropertyDefinitionMap.cxx51
-rw-r--r--Source/cmPropertyDefinitionMap.h6
-rw-r--r--Source/cmStandardIncludes.h13
-rw-r--r--Source/cmake.cxx44
-rw-r--r--Source/cmake.h8
-rw-r--r--Source/cmakemain.cxx57
-rw-r--r--Source/ctest.cxx20
44 files changed, 911 insertions, 916 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 17f8137..67efbb2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -113,6 +113,7 @@ SET(SRCS
cmDocumentationFormatterMan.cxx
cmDocumentationFormatterText.cxx
cmDocumentationFormatterUsage.cxx
+ cmDocumentationSection.cxx
cmDocumentVariables.cxx
cmDynamicLoader.cxx
cmDynamicLoader.h
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index ba9820f..bb071e9 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -31,7 +31,7 @@
#include <cmsys/CommandLineArguments.hxx>
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char * cmDocumentationName[][3] =
{
{0,
" cpack - Packaging driver provided by CMake.", 0},
@@ -39,7 +39,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char * cmDocumentationUsage[][3] =
{
{0,
" cpack -G <generator> [options]",
@@ -48,7 +48,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char * cmDocumentationDescription[][3] =
{
{0,
"The \"cpack\" executable is the CMake packaging program. "
@@ -60,7 +60,7 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char * cmDocumentationOptions[][3] =
{
{"-G <generator>", "Use the specified generator to generate package.",
"CPack may support multiple native packaging systems on certain "
@@ -79,7 +79,7 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationSeeAlso[] =
+static const char * cmDocumentationSeeAlso[][3] =
{
{0, "cmake", 0},
{0, "ccmake", 0},
@@ -447,10 +447,10 @@ int main (int argc, char *argv[])
doc.CheckOptions(argc, argv);
// Construct and print requested documentation.
doc.SetName("cpack");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetOptionsSection(cmDocumentationOptions);
+ doc.SetSection("Name",cmDocumentationName);
+ doc.SetSection("Usage",cmDocumentationUsage);
+ doc.SetSection("Description",cmDocumentationDescription);
+ doc.SetSection("Options",cmDocumentationOptions);
std::vector<cmDocumentationEntry> v;
cmCPackGenerators::DescriptionsMap::const_iterator generatorIt;
@@ -459,14 +459,12 @@ int main (int argc, char *argv[])
++ generatorIt )
{
cmDocumentationEntry e;
- e.name = generatorIt->first.c_str();
- e.brief = generatorIt->second.c_str();
- e.full = "";
+ e.Name = generatorIt->first.c_str();
+ e.Brief = generatorIt->second.c_str();
+ e.Full = "";
v.push_back(e);
}
- cmDocumentationEntry empty = {0,0,0};
- v.push_back(empty);
- doc.SetGeneratorsSection(&v[0]);
+ doc.SetSection("Generators",v);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
#undef cout
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 1e26b79..7f9b3f6 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -28,7 +28,7 @@
#include <form.h>
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char * cmDocumentationName[][3] =
{
{0,
" ccmake - Curses Interface for CMake.", 0},
@@ -36,7 +36,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char * cmDocumentationUsage[][3] =
{
{0,
" ccmake <path-to-source>\n"
@@ -45,7 +45,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char * cmDocumentationDescription[][3] =
{
{0,
"The \"ccmake\" executable is the CMake curses interface. Project "
@@ -57,14 +57,14 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char * cmDocumentationOptions[][3] =
{
CMAKE_STANDARD_OPTIONS_TABLE,
{0,0,0}
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationSeeAlso[] =
+static const char * cmDocumentationSeeAlso[][3] =
{
{0, "cmake", 0},
{0, "ctest", 0},
@@ -116,13 +116,13 @@ int main(int argc, char** argv)
hcm.GetCommandDocumentation(compatCommands, false, true);
hcm.GetGeneratorDocumentation(generators);
doc.SetName("ccmake");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetGeneratorsSection(&generators[0]);
- doc.SetOptionsSection(cmDocumentationOptions);
- doc.SetCommandsSection(&commands[0]);
- doc.SetCompatCommandsSection(&compatCommands[0]);
+ doc.SetSection("Name",cmDocumentationName);
+ doc.SetSection("Usage",cmDocumentationUsage);
+ doc.SetSection("Description",cmDocumentationDescription);
+ doc.SetSection("Generators",generators);
+ doc.SetSection("Options",cmDocumentationOptions);
+ doc.SetSection("Command",commands);
+ doc.SetSection("Compatibility Commands",compatCommands);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
return doc.PrintRequestedDocumentation(std::cout)? 0:1;
}
diff --git a/Source/MFCDialog/CMakeSetup.cpp b/Source/MFCDialog/CMakeSetup.cpp
index 3f59257..63fa23d 100644
--- a/Source/MFCDialog/CMakeSetup.cpp
+++ b/Source/MFCDialog/CMakeSetup.cpp
@@ -10,7 +10,7 @@
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char * cmDocumentationName[][3] =
{
{0,
" CMakeSetup - CMake Windows GUI.", 0},
@@ -18,7 +18,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char * cmDocumentationUsage[][3] =
{
{0,
" CMakeSetup [options]\n"
@@ -28,7 +28,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char * cmDocumentationDescription[][3] =
{
{0,
"The \"CMakeSetup\" executable is the CMake Windows GUI. Project "
@@ -40,7 +40,7 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char * cmDocumentationOptions[][3] =
{
{"-A[on|off]", "Enable/disable display of advanced cache values.",
"There are two categories of CMake cache values: non-advanced and "
@@ -121,13 +121,13 @@ BOOL CMakeSetup::InitInstance()
hcm.GetCommandDocumentation(compatCommands, false, true);
hcm.GetGeneratorDocumentation(generators);
doc.SetName("cmake");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetGeneratorsSection(&generators[0]);
- doc.SetOptionsSection(cmDocumentationOptions);
- doc.SetCommandsSection(&commands[0]);
- doc.SetCompatCommandsSection(&compatCommands[0]);
+ doc.SetSection("Name",cmDocumentationName);
+ doc.SetSection("Usage",cmDocumentationUsage);
+ doc.SetSection("Description",cmDocumentationDescription);
+ doc.SetSection("Generators",generators);
+ doc.SetSection("Options",cmDocumentationOptions);
+ doc.SetSection("Commands",commands);
+ doc.SetSection("Compatilbility Commands", compatCommands);
return (doc.PrintRequestedDocumentation(std::cout)? 0:1);
}
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 0819aa0..9ef97cb 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -11,19 +11,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This is the full path to the CMake executable cmake which is "
"useful from custom commands that want to use the cmake -E "
"option for portable system commands. "
- "(e.g. /usr/local/bin/cmake");
+ "(e.g. /usr/local/bin/cmake", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_BINARY_DIR", cmProperty::VARIABLE,
"The path to the top level of the build tree.",
"This is the full path to the top level of the current CMake "
"build tree. For an in-source build, this would be the same "
- "as CMAKE_SOURCE_DIR. ");
+ "as CMAKE_SOURCE_DIR. ", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_SOURCE_DIR", cmProperty::VARIABLE,
"The path to the top level of the source tree.",
"This is the full path to the top level of the current CMake "
"source tree. For an in-source build, this would be the same "
- "as CMAKE_BINARY_DIR. ");
+ "as CMAKE_BINARY_DIR. ", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CURRENT_BINARY_DIR", cmProperty::VARIABLE,
"The path to the binary directory currently being processed.",
@@ -32,22 +35,26 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"add_subdirectory will create a binary directory in the build "
"tree, and as it is being processed this variable will be set. "
"For in-source builds this is the current source directory "
- "being processed.");
+ "being processed.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CURRENT_SOURCE_DIR", cmProperty::VARIABLE,
"The path to the source directory currently being processed.",
"This the full path to the source directory that is currently "
- "being processed by cmake. ");
+ "being processed by cmake. ", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CURRENT_LIST_FILE", cmProperty::VARIABLE,
"The path to the file currently being processed.",
"This the full path to the file that is currently "
- "being processed by cmake. ");
+ "being processed by cmake. ", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CURRENT_LIST_LINE", cmProperty::VARIABLE,
"The line number of the current file being processed.",
"This is the line number of the file currently being"
- " processed by cmake.");
+ " processed by cmake.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_BUILD_TOOL", cmProperty::VARIABLE,
"Tool used for the acutal build process.",
@@ -59,27 +66,31 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"and for Visual Studio 7 it set to devenv. For "
"Nmake Makefiles the value is nmake. This can be "
"useful for adding special flags and commands based"
- " on the final build environment. ");
+ " on the final build environment. ", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CACHEFILE_DIR", cmProperty::VARIABLE,
"The directory with the CMakeCache.txt file.",
"This is the full path to the directory that has the "
"CMakeCache.txt file in it. This is the same as "
- "CMAKE_BINARY_DIR.");
+ "CMAKE_BINARY_DIR.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CACHE_MAJOR_VERSION", cmProperty::VARIABLE,
"Major version of CMake used to create the CMakeCache.txt file",
"This is stores the major version of CMake used to "
"write a CMake cache file. It is only different when "
"a different version of CMake is run on a previously "
- "created cache file.");
+ "created cache file.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CACHE_MINOR_VERSION", cmProperty::VARIABLE,
"Minor version of CMake used to create the CMakeCache.txt file",
"This is stores the minor version of CMake used to "
"write a CMake cache file. It is only different when "
"a different version of CMake is run on a previously "
- "created cache file.");
+ "created cache file.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CACHE_RELEASE_VERSION", cmProperty::VARIABLE,
@@ -87,7 +98,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This is stores the release version of CMake used to "
"write a CMake cache file. It is only different when "
"a different version of CMake is run on a previously "
- "created cache file.");
+ "created cache file.", false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CFG_INTDIR", cmProperty::VARIABLE,
@@ -111,7 +123,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"compiler. If it has a value, it will be the "
"intermediate directory used to build the file. "
"This way an executable or a library can find files "
- "that are located in the build directory.");
+ "that are located in the build directory.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_CTEST_COMMAND", cmProperty::VARIABLE,
@@ -119,128 +132,150 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This is the full path to the CTest executable ctest "
"which is useful from custom commands that want "
" to use the cmake -E option for portable system "
- "commands.");
+ "commands.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_DL_LIBS", cmProperty::VARIABLE,
"Name of library containing dlopen and dlcose.",
"The name of the library that has dlopen and "
- "dlclose in it, usually -ldl on most UNIX machines.");
+ "dlclose in it, usually -ldl on most UNIX machines.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_EDIT_COMMAND", cmProperty::VARIABLE,
"Full path to CMakeSetup or ccmake.",
"This is the full path to the CMake executable "
"that can graphically edit the cache. For example,"
- " CMakeSetup, ccmake, or cmake -i.");
+ " CMakeSetup, ccmake, or cmake -i.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_GENERATOR", cmProperty::VARIABLE,
"The generator used to build the project.",
"The name of the generator that is being used to generate the "
"build files. (e.g. \"Unix Makefiles\", "
- "\"Visual Studio 6\", etc.)");
+ "\"Visual Studio 6\", etc.)",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_HOME_DIRECTORY", cmProperty::VARIABLE,
"Path to top of source tree.",
- "This is the path to the top level of the source tree.");
+ "This is the path to the top level of the source tree.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_LINK_LIBRARY_SUFFIX", cmProperty::VARIABLE,
"The suffix for libraries that you link to.",
- "The suffix to use for the end of a library, .lib on Windows.");
+ "The suffix to use for the end of a library, .lib on Windows.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_MAJOR_VERSION", cmProperty::VARIABLE,
"The Major version of cmake (i.e. the 2 in 2.X.X)",
"This specifies the major version of the CMake executable"
- " being run.");
+ " being run.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_MAKE_PROGRAM", cmProperty::VARIABLE,
"See CMAKE_BUILD_TOOL.",
"This variable is around for backwards compatibility, "
- "see CMAKE_BUILD_TOOL.");
+ "see CMAKE_BUILD_TOOL.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_MINOR_VERSION", cmProperty::VARIABLE,
"The Minor version of cmake (i.e. the 4 in X.4.X).",
"This specifies the minor version of the CMake"
- " executable being run.");
+ " executable being run.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_PROJECT_NAME", cmProperty::VARIABLE,
"The name of the current project.",
"This specifies name of the current project from"
- " the closest inherited PROJECT command.");
+ " the closest inherited PROJECT command.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_RANLIB", cmProperty::VARIABLE,
"Name of randomizing tool for static libraries.",
"This specifies name of the program that randomizes "
- "libraries on UNIX, not used on Windows, but may be present.");
+ "libraries on UNIX, not used on Windows, but may be present.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_ROOT", cmProperty::VARIABLE,
"Install directory for running cmake.",
"This is the install root for the running CMake and"
" the Modules directory can be found here. This is"
- " commonly used in this format: ${CMAKE_ROOT}/Modules");
+ " commonly used in this format: ${CMAKE_ROOT}/Modules",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_SIZEOF_VOID_P", cmProperty::VARIABLE,
"Size of a void pointer.",
"This is set to the size of a pointer on the machine, "
"and is determined by a try compile. If a 64 bit size "
"is found, then the library search path is modified to "
- "look for 64 bit libraries first.");
+ "look for 64 bit libraries first.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_SKIP_RPATH", cmProperty::VARIABLE,
"If true, do not add run time path information.",
"If this is set to TRUE, then the rpath information "
"is not added to compiled executables. The default"
"is to add rpath information if the platform supports it."
- "This allows for easy running from the build tree.");
+ "This allows for easy running from the build tree.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_SOURCE_DIR", cmProperty::VARIABLE,
"Source directory for project.",
"This is the top level source directory for the project. "
"It corresponds to the source directory given to "
- "CMakeSetup or ccmake.");
+ "CMakeSetup or ccmake.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_STANDARD_LIBRARIES", cmProperty::VARIABLE,
"Libraries linked into every executable and shared library.",
"This is the list of libraries that are linked "
- "into all executables and libraries.");
+ "into all executables and libraries.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_USING_VC_FREE_TOOLS", cmProperty::VARIABLE,
"True if free visual studio tools being used.",
"This is set to true if the compiler is Visual "
- "Studio free tools.");
+ "Studio free tools.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("CMAKE_VERBOSE_MAKEFILE", cmProperty::VARIABLE,
"Create verbose makefiles if on.",
"This variable defaults to false. You can set "
"this variable to true to make CMake produce verbose "
- "makefiles that show each command line as it is used.");
+ "makefiles that show each command line as it is used.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("PROJECT_BINARY_DIR", cmProperty::VARIABLE,
"Full path to build directory for project.",
"This is the binary directory of the most recent "
- "PROJECT command.");
+ "PROJECT command.",false,"Variables that Provide Information");
cm->DefineProperty
("PROJECT_NAME", cmProperty::VARIABLE,
"Name of the project given to the project command.",
"This is the name given to the most "
- "recent PROJECT command. ");
+ "recent PROJECT command. ",false,
+ "Variables that Provide Information");
cm->DefineProperty
("PROJECT_SOURCE_DIR", cmProperty::VARIABLE,
"Top level source directory for the current project.",
"This is the source directory of the most recent "
- "PROJECT command.");
+ "PROJECT command.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("[Project name]_BINARY_DIR", cmProperty::VARIABLE,
"Top level binary directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the binary directory for the project. "
" This can be useful when SUBDIR is used to connect "
- "several projects.");
+ "several projects.",false,
+ "Variables that Provide Information");
cm->DefineProperty
("[Project name]_SOURCE_DIR", cmProperty::VARIABLE,
"Top level source directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the source directory for the project."
" This can be useful when add_subdirectory "
- "is used to connect several projects.");
+ "is used to connect several projects.",false,
+ "Variables that Provide Information");
// Variables defined by cmake, that change the behavior
// of cmake
@@ -255,7 +290,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"variables with the name "
" CMAKE_C_FLAGS_[Debug|Release|RelWithDebInfo|MinSizeRel]."
" For example, if CMAKE_BUILD_TYPE is Debug, then "
- "CMAKE_C_FLAGS_DEBUG will be added to the CMAKE_C_FLAGS.");
+ "CMAKE_C_FLAGS_DEBUG will be added to the CMAKE_C_FLAGS.",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_BACKWARDS_COMPATIBILITY", cmProperty::VARIABLE,
@@ -267,7 +303,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
" CMake to support deprecated commands of CMake in projects"
" that were written to use older versions of CMake. This "
"can be set by the user or set at the beginning of a "
- "CMakeLists file.");
+ "CMakeLists file.",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_INSTALL_PREFIX", cmProperty::VARIABLE,
@@ -275,7 +312,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"If \"make install\" is invoked or INSTALL is built"
", this directory is pre-pended onto all install "
"directories. This variable defaults to /usr/local"
- " on UNIX and c:/Program Files on Windows.");
+ " on UNIX and c:/Program Files on Windows.",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE,
"Specify a file that can change the build rule variables.",
@@ -284,7 +322,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"after all the system settings have been set, but "
"before they have been used. This would allow you "
"to override any variables that need to be changed "
- "for some special project. ");
+ "for some special project. ",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("BUILD_SHARED_LIBS", cmProperty::VARIABLE,
@@ -294,13 +333,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"static library. This variable is often added to projects "
"as an OPTION so that each user of a project can decide if "
"they want to build the project using shared or static "
- "libraries.");
+ "libraries.",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_NOT_USING_CONFIG_FLAGS", cmProperty::VARIABLE,
"Skip _BUILD_TYPE flags if true.",
"This is an internal flag used by the generators in "
- "CMake to tell CMake to skip the _BUILD_TYPE flags.");
+ "CMake to tell CMake to skip the _BUILD_TYPE flags.",false,
+ "Variables That Change Behavior");
cm->DefineProperty
("CMAKE_MFC_FLAG", cmProperty::VARIABLE,
@@ -313,7 +354,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"dialog uses MFC and the CMakeLists.txt looks like this:\n"
"ADD_DEFINITIONS(-D_AFXDLL)\n"
"set(CMAKE_MFC_FLAG 2)\n"
- "add_executable(CMakeSetup WIN32 ${SRCS})\n");
+ "add_executable(CMakeSetup WIN32 ${SRCS})\n",false,
+ "Variables That Change Behavior");
// Variables defined by CMake that describe the system
@@ -325,7 +367,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"and CMAKE_SYSTEM_VERSION, like this "
"${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}. "
"If CMAKE_SYSTEM_VERSION is not set, then "
- "CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME.");
+ "CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME.",false,
+ "Variables That Describe the System");
cm->DefineProperty
("CMAKE_SYSTEM_NAME", cmProperty::VARIABLE,
"Name of the OS CMake is running on.",
@@ -334,47 +377,55 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"have the uname command, this variable is set "
"to the output of uname -s. Linux, Windows, "
" and Darwin for Mac OSX are the values found "
- " on the big three operating systems." );
+ " on the big three operating systems." ,false,
+ "Variables That Describe the System");
cm->DefineProperty
("CMAKE_SYSTEM_PROCESSOR", cmProperty::VARIABLE,
"The name of the CPU CMake is running on.",
"On systems that support uname, this variable is "
"set to the output of uname -p, on windows it is "
"set to the value of the environment variable "
- "PROCESSOR_ARCHITECTURE");
+ "PROCESSOR_ARCHITECTURE",false,
+ "Variables That Describe the System");
cm->DefineProperty
("CMAKE_SYSTEM_VERSION", cmProperty::VARIABLE,
"OS version.",
"A numeric version string for the system, on "
"systems that support uname, this variable is "
"set to the output of uname -r. On other "
- "systems this is set to major-minor version numbers.");
+ "systems this is set to major-minor version numbers.",false,
+ "Variables That Describe the System");
cm->DefineProperty
("APPLE", cmProperty::VARIABLE,
"True if running on Mac OSX.",
- "Set to true on Mac OSX.");
+ "Set to true on Mac OSX.",false,
+ "Variables That Describe the System");
cm->DefineProperty
("BORLAND", cmProperty::VARIABLE,
"True of the borland compiler is being used.",
- "This is set to true if the Borland compiler is being used.");
+ "This is set to true if the Borland compiler is being used.",false,
+ "Variables That Describe the System");
cm->DefineProperty
("CYGWIN", cmProperty::VARIABLE,
"True for cygwin.",
- "Set to true when using CYGWIN.");
+ "Set to true when using CYGWIN.",false,
+ "Variables That Describe the System");
cm->DefineProperty
("UNIX", cmProperty::VARIABLE,
"True for UNIX and UNIX like operating systems.",
"Set to true when the system is UNIX or UNIX like "
- "(i.e. APPLE and CYGWIN).");
+ "(i.e. APPLE and CYGWIN).",false,
+ "Variables That Describe the System");
cm->DefineProperty
("WIN32", cmProperty::VARIABLE,
"Tru on windows systems, including win64.",
- "Set to true when the system is Windows and on cygwin.");
+ "Set to true when the system is Windows and on cygwin.",false,
+ "Variables That Describe the System");
// Variables that affect the building of object files and
// targets.
@@ -382,28 +433,33 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("CMAKE_EXE_LINKER_FLAGS", cmProperty::VARIABLE,
"Linker flags used to create executables.",
- "Flags used by the linker when creating an executable.");
+ "Flags used by the linker when creating an executable.",false,
+ "Variables that Control the Build");
cm->DefineProperty
("CMAKE_EXE_LINKER_FLAGS_[CMAKE_BUILD_TYPE]", cmProperty::VARIABLE,
"Flag used when linking an executable.",
"Same as CMAKE_C_FLAGS_* but used by the linker "
- "when creating executables.");
+ "when creating executables.",false,
+ "Variables that Control the Build");
cm->DefineProperty
("CMAKE_LIBRARY_PATH_FLAG", cmProperty::VARIABLE,
"The flag used to add a library search path to a compiler.",
"The flag used to specify a library directory to the compiler. "
- "On most compilers this is \"-L\".");
+ "On most compilers this is \"-L\".",false,
+ "Variables that Control the Build");
cm->DefineProperty
("CMAKE_LINK_DEF_FILE_FLAG ", cmProperty::VARIABLE,
"Linker flag used to specify a .def file for dll creation.",
"The flag used to add a .def file when creating "
- "a dll on Windows, this is only defined on Windows.");
+ "a dll on Windows, this is only defined on Windows.",false,
+ "Variables that Control the Build");
cm->DefineProperty
("CMAKE_LINK_LIBRARY_FLAG", cmProperty::VARIABLE,
"Flag used to link a library into an executable.",
"The flag used to specify a library to link to an executable. "
- "On most compilers this is \"-l\".");
+ "On most compilers this is \"-l\".",false,
+ "Variables that Control the Build");
cm->DefineProperty
("CMAKE_USE_RELATIVE_PATHS", cmProperty::VARIABLE,
"Use relative paths (May not work!).",
@@ -413,17 +469,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"projects, and relative paths are used when possible. "
"In general, it is not possible to move CMake generated"
" makefiles to a different location regardless "
- "of the value of this variable.");
+ "of the value of this variable.",false,
+ "Variables that Control the Build");
cm->DefineProperty
("EXECUTABLE_OUTPUT_PATH", cmProperty::VARIABLE,
"Location for all executables in a project.",
"If set, this is the directory where all executables "
- "built during the build process will be placed.");
+ "built during the build process will be placed.",false,
+ "Variables that Control the Build");
cm->DefineProperty
("LIBRARY_OUTPUT_PATH", cmProperty::VARIABLE,
"Location for all libraries in a project.",
"If set, this is the directory where all the libraries "
- "built during the build process will be placed.");
+ "built during the build process will be placed.",false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
// also be defined whenever CMake has loaded its support for compiling (LANG)
@@ -434,87 +493,96 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
("CMAKE_<LANG>_COMPILER", cmProperty::VARIABLE,
"The full path to the compiler for LANG.",
"This is the command that will be used as the <LANG> compiler. "
- "Once set, you can not change this variable.");
+ "Once set, you can not change this variable.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_COMPILER_IS_GNU<LANG>", cmProperty::VARIABLE,
"True if the compiler is GNU.",
"If the selected <LANG> compiler is the GNU "
- "compiler then this is TRUE, if not it is FALSE. ");
+ "compiler then this is TRUE, if not it is FALSE.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_FLAGS_DEBUG", cmProperty::VARIABLE,
"Flags for Debug build type or configuration.",
- "<LANG> flags used when CMAKE_BUILD_TYPE is Debug.");
+ "<LANG> flags used when CMAKE_BUILD_TYPE is Debug.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_FLAGS_MINSIZEREL", cmProperty::VARIABLE,
"Flags for MinSizeRel build type or configuration.",
"<LANG> flags used when CMAKE_BUILD_TYPE is MinSizeRel."
- "Short for minimum size release.");
+ "Short for minimum size release.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_FLAGS_RELEASE", cmProperty::VARIABLE,
"Flags for Release build type or configuration.",
- "<LANG> flags used when CMAKE_BUILD_TYPE is Release");
+ "<LANG> flags used when CMAKE_BUILD_TYPE is Release",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_FLAGS_RELWITHDEBINFO", cmProperty::VARIABLE,
"Flags for RelWithDebInfo type or configuration.",
"<LANG> flags used when CMAKE_BUILD_TYPE is RelWithDebInfo. "
- "Short for Release With Debug Information.");
+ "Short for Release With Debug Information.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_COMPILE_OBJECT", cmProperty::VARIABLE,
"Rule variable to compile a single object file.",
"This is a rule variable that tells CMake how to "
- "compile a single object file for for the language <LANG>.");
+ "compile a single object file for for the language <LANG>.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_CREATE_SHARED_LIBRARY", cmProperty::VARIABLE,
"Rule variable to create a shared library.",
"This is a rule variable that tells CMake how to "
- "create a shared library for the language <LANG>.");
+ "create a shared library for the language <LANG>.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_CREATE_SHARED_MODULE", cmProperty::VARIABLE,
"Rule variable to create a shared module.",
"This is a rule variable that tells CMake how to "
- "create a shared library for the language <LANG>.");
+ "create a shared library for the language <LANG>.",false,
+ "Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_CREATE_STATIC_LIBRARY", cmProperty::VARIABLE,
"Rule variable to create a static library.",
"This is a rule variable that tells CMake how "
- "to create a static library for the language <LANG>.");
+ "to create a static library for the language <LANG>.",false,"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_IGNORE_EXTENSIONS", cmProperty::VARIABLE,
"File extensions that should be ignored by the build.",
"This is a list of file extensions that may be "
- "part of a project for a given language but are not compiled. ");
+ "part of a project for a given language but are not compiled. ",false,"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_LINKER_PREFERENCE", cmProperty::VARIABLE,
"Determine if a language should be used for linking.",
"If this is \"Preferred\" then if there is a mixed "
"language shared library or executable, then this "
- "languages linker command will be used.");
+ "languages linker command will be used.",false,"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_LINK_EXECUTABLE ", cmProperty::VARIABLE,
"Rule variable to link and executable.",
- "Rule variable to link and executable for the given language.");
+ "Rule variable to link and executable for the given language.",false,"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_OUTPUT_EXTENSION", cmProperty::VARIABLE,
"Extension for the output of a compile for a single file.",
"This is the extension for an object file for "
- "the given <LANG>. For example .obj for C on Windows.");
+ "the given <LANG>. For example .obj for C on Windows.",false,"Variables for Languages");
cm->DefineProperty
("CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS", cmProperty::VARIABLE,
"Extensions of source files for the given language.",
"This is the list of extensions for a "
- "given languages source files.");
+ "given languages source files.",false,"Variables for Languages");
}
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index a521cc7..6c50c40 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -21,10 +21,8 @@
#include <cmsys/Directory.hxx>
-const cmDocumentationEntry cmDocumentation::cmSection::EmptySection ={0,0,0};
-
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationStandardOptions[] =
+static const char *cmDocumentationStandardOptions[][3] =
{
{"--copyright [file]", "Print the CMake copyright and exit.",
"If a file is specified, the copyright is written into it."},
@@ -47,7 +45,7 @@ static const cmDocumentationEntry cmDocumentationStandardOptions[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmModulesDocumentationDescription[] =
+static const char *cmModulesDocumentationDescription[][3] =
{
{0,
" CMake Modules - Modules coming with CMake, the Cross-Platform Makefile "
@@ -62,7 +60,7 @@ static const cmDocumentationEntry cmModulesDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmCustomModulesDocumentationDescription[] =
+static const char *cmCustomModulesDocumentationDescription[][3] =
{
{0,
" Custom CMake Modules - Additional Modules for CMake.", 0},
@@ -76,7 +74,7 @@ static const cmDocumentationEntry cmCustomModulesDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmPropertiesDocumentationDescription[] =
+static const char *cmPropertiesDocumentationDescription[][3] =
{
{0,
" CMake Properties - Properties supported by CMake, "
@@ -92,7 +90,7 @@ static const cmDocumentationEntry cmPropertiesDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmCompatCommandsDocumentationDescription[] =
+static const char *cmCompatCommandsDocumentationDescription[][3] =
{
{0,
" CMake Compatibility Listfile Commands - "
@@ -106,7 +104,7 @@ static const cmDocumentationEntry cmCompatCommandsDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationCommandsHeader[] =
+static const char *cmDocumentationCommandsHeader[][3] =
{
{0,
"The following commands are available in CMakeLists.txt code:", 0},
@@ -114,7 +112,7 @@ static const cmDocumentationEntry cmDocumentationCommandsHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationGlobalPropertiesHeader[] =
+static const char *cmDocumentationGlobalPropertiesHeader[][3] =
{
{0,
"The following global properties are available in CMakeLists.txt code:", 0},
@@ -122,7 +120,7 @@ static const cmDocumentationEntry cmDocumentationGlobalPropertiesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDirectoryPropertiesHeader[] =
+static const char *cmDocumentationDirectoryPropertiesHeader[][3] =
{
{0
,"The following directory properties are available in CMakeLists.txt code:"
@@ -131,7 +129,7 @@ static const cmDocumentationEntry cmDocumentationDirectoryPropertiesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationTargetPropertiesHeader[] =
+static const char *cmDocumentationTargetPropertiesHeader[][3] =
{
{0,
"The following target properties are available in CMakeLists.txt code:", 0},
@@ -139,7 +137,7 @@ static const cmDocumentationEntry cmDocumentationTargetPropertiesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationTestPropertiesHeader[] =
+static const char *cmDocumentationTestPropertiesHeader[][3] =
{
{0
,"The following properties for tests are available in CMakeLists.txt code:"
@@ -148,7 +146,7 @@ static const cmDocumentationEntry cmDocumentationTestPropertiesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationSourceFilePropertiesHeader[] =
+static const char *cmDocumentationSourceFilePropertiesHeader[][3] =
{
{0
,"The following source file properties are available in CMakeLists.txt code:"
@@ -157,22 +155,21 @@ static const cmDocumentationEntry cmDocumentationSourceFilePropertiesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationVariablePropertiesHeader[] =
+static const char *cmDocumentationVariablePropertiesHeader[][3] =
{
{0, "The following variables are available in CMakeLists.txt code:", 0},
{0,0,0}
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry
- cmDocumentationCachedVariablePropertiesHeader[] =
+static const char *cmDocumentationCachedVariablePropertiesHeader[][3] =
{
{0,"The following cache variables are available in CMakeLists.txt code:", 0},
{0,0,0}
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationModulesHeader[] =
+static const char *cmDocumentationModulesHeader[][3] =
{
{0,
"The following modules are provided with CMake. "
@@ -181,7 +178,7 @@ static const cmDocumentationEntry cmDocumentationModulesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationCustomModulesHeader[] =
+static const char *cmDocumentationCustomModulesHeader[][3] =
{
{0,
"The following modules are also available for CMake. "
@@ -190,7 +187,7 @@ static const cmDocumentationEntry cmDocumentationCustomModulesHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationGeneratorsHeader[] =
+static const char *cmDocumentationGeneratorsHeader[][3] =
{
{0,
"The following generators are available on this platform:", 0},
@@ -198,7 +195,7 @@ static const cmDocumentationEntry cmDocumentationGeneratorsHeader[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationStandardSeeAlso[] =
+static const char *cmDocumentationStandardSeeAlso[][3] =
{
{0,
"The following resources are available to get help using CMake:", 0},
@@ -229,15 +226,7 @@ static const cmDocumentationEntry cmDocumentationStandardSeeAlso[] =
};
//----------------------------------------------------------------------------
-const cmDocumentationEntry cmDocumentationAuthor[] =
-{
- {0,
- "This manual page was generated by the \"--help-man\" option.", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-const cmDocumentationEntry cmDocumentationCopyright[] =
+static const char *cmDocumentationCopyright[][3] =
{
{0,
"Copyright (c) 2002 Kitware, Inc., Insight Consortium. "
@@ -279,43 +268,26 @@ const cmDocumentationEntry cmDocumentationCopyright[] =
//----------------------------------------------------------------------------
cmDocumentation::cmDocumentation()
-:NameSection ("Name", "NAME")
-,UsageSection ("Usage", "SYNOPSIS")
-,DescriptionSection ("", "DESCRIPTION")
-,OptionsSection ("Command-Line Options", "OPTIONS")
-,CommandsSection ("Listfile Commands", "COMMANDS")
-,CompatCommandsSection("Compatibility Listfile Commands",
- "COMPATIBILITY COMMANDS")
-,ModulesSection ("Standard CMake Modules", "MODULES")
-,CustomModulesSection ("Custom CMake Modules", "CUSTOM MODULES")
-,GeneratorsSection ("Generators", "GENERATORS")
-,SeeAlsoSection ("See Also", "SEE ALSO")
-,CopyrightSection ("Copyright", "COPYRIGHT")
-,AuthorSection ("Author", "AUTHOR")
-,GlobalPropertiesSection ("Standard Properties", "GLOBAL PROPERTIES")
-,DirectoryPropertiesSection ("Directory Properties",
- "DIRECTORY PROPERTIES")
-,TargetPropertiesSection ("Target Properties", "TARGET PROPERTIES")
-,TestPropertiesSection ("Test Properties", "TEST PROPERTIES")
-,SourceFilePropertiesSection ("Sourcefile Properties",
- "SOURCEFILE PROPERTIES")
-,VariablePropertiesSection ("Variables", "VARIABLES")
-,CachedVariablePropertiesSection("Cached Variables", "CACHE VARIABLES")
-,CurrentFormatter(0)
+:CurrentFormatter(0)
{
this->SetForm(TextForm);
- this->PropertySections[cmProperty::GLOBAL] = &this->GlobalPropertiesSection;
- this->PropertySections[cmProperty::DIRECTORY] =
- &this->DirectoryPropertiesSection;
- this->PropertySections[cmProperty::TARGET] = &this->TargetPropertiesSection;
- this->PropertySections[cmProperty::TEST] = &this->TestPropertiesSection;
- this->PropertySections[cmProperty::SOURCE_FILE] =
- &this->SourceFilePropertiesSection;
- this->PropertySections[cmProperty::VARIABLE] =
- &this->VariablePropertiesSection;
- this->PropertySections[cmProperty::CACHED_VARIABLE] =
- &this->CachedVariablePropertiesSection;
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Author","AUTHOR");
+ sec->Append(cmDocumentationEntry
+ (0,
+ "This manual page was generated by the \"--help-man\" option.",
+ 0));
+ this->AllSections["Author"] = sec;
+
+ sec = new cmDocumentationSection("Copyright","COPYRIGHT");
+ sec->Append(cmDocumentationCopyright);
+ this->AllSections["Copyright"] = sec;
+
+ sec = new cmDocumentationSection("See Also","SEE ALSO");
+ sec->Append(cmDocumentationStandardSeeAlso);
+ this->AllSections["Standard See Also"] = sec;
}
//----------------------------------------------------------------------------
@@ -331,19 +303,21 @@ cmDocumentation::~cmDocumentation()
//----------------------------------------------------------------------------
bool cmDocumentation::PrintCopyright(std::ostream& os)
{
- for(const cmDocumentationEntry* op = cmDocumentationCopyright;
- op->brief; ++op)
+ cmDocumentationSection *sec = this->AllSections["Copyright"];
+ const std::vector<cmDocumentationEntry> &entries = sec->GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
+ op != entries.end(); ++op)
{
- if(op->name)
+ if(op->Name.size())
{
os << " * ";
this->TextFormatter.SetIndent(" ");
- this->TextFormatter.PrintColumn(os, op->brief);
+ this->TextFormatter.PrintColumn(os, op->Brief.c_str());
}
else
{
this->TextFormatter.SetIndent("");
- this->TextFormatter.PrintColumn(os, op->brief);
+ this->TextFormatter.PrintColumn(os, op->Brief.c_str());
}
os << "\n";
}
@@ -359,28 +333,19 @@ bool cmDocumentation::PrintVersion(std::ostream& os)
}
//----------------------------------------------------------------------------
-void cmDocumentation::AddSection(const char* name,
- const cmDocumentationEntry* d)
-{
- this->Names.push_back(name);
- this->Sections.push_back(d);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::AddSection(const cmSection& section)
+void cmDocumentation::AddSectionToPrint(const char *section)
{
- if (!section.IsEmpty())
+ if (this->AllSections.find(section) != this->AllSections.end())
{
- this->Names.push_back(section.GetName(this->CurrentFormatter->GetForm()));
- this->Sections.push_back(section.GetEntries());
+ this->PrintSections.push_back(this->AllSections[section]);
}
}
//----------------------------------------------------------------------------
void cmDocumentation::ClearSections()
{
- this->Names.erase(this->Names.begin(), this->Names.end());
- this->Sections.erase(this->Sections.begin(), this->Sections.end());
+ this->PrintSections.erase(this->PrintSections.begin(),
+ this->PrintSections.end());
}
//----------------------------------------------------------------------------
@@ -402,13 +367,20 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
return this->PrintDocumentationSingleModule(os);
case cmDocumentation::SingleProperty:
return this->PrintDocumentationSingleProperty(os);
- case cmDocumentation::List:
- return this->PrintDocumentationList(os);
+ case cmDocumentation::List:
+ this->PrintDocumentationList(os,"Commands");
+ this->PrintDocumentationList(os,"Compatibility Commands");
+ return true;
case cmDocumentation::ModuleList:
- return this->PrintModuleList(os);
+ this->PrintDocumentationList(os,"Modules");
+ return true;
case cmDocumentation::PropertyList:
- return this->PrintPropertyList(os);
-
+ this->PrintDocumentationList(os,"Properties of Global Scope");
+ this->PrintDocumentationList(os,"Properties on Directories");
+ this->PrintDocumentationList(os,"Properties on Targets");
+ this->PrintDocumentationList(os,"Properties on Tests");
+ this->PrintDocumentationList(os,"Properties on Source Files");
+ return true;
case cmDocumentation::Full:
return this->PrintDocumentationFull(os);
case cmDocumentation::Modules:
@@ -433,16 +405,17 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::CreateModulesSection()
{
+ cmDocumentationSection *sec =
+ new cmDocumentationSection("Standard CMake Modules", "MODULES");
+ this->AllSections["Modules"] = sec;
std::string cmakeModules = this->CMakeRoot;
cmakeModules += "/Modules";
cmsys::Directory dir;
dir.Load(cmakeModules.c_str());
if (dir.GetNumberOfFiles() > 0)
{
- this->ModulesSection.Append(cmDocumentationModulesHeader[0]);
- this->CreateModuleDocsForDir(dir, this->ModulesSection);
- cmDocumentationEntry e = { 0, 0, 0 };
- this->ModulesSection.Append(e);
+ this->AllSections["Modules"]->Append(cmDocumentationModulesHeader[0]);
+ this->CreateModuleDocsForDir(dir, *this->AllSections["Modules"]);
}
return true;
}
@@ -465,25 +438,24 @@ bool cmDocumentation::CreateCustomModulesSection()
{
if (!sectionHasHeader)
{
- this->CustomModulesSection.Append(
- cmDocumentationCustomModulesHeader[0]);
+ cmDocumentationSection *sec =
+ new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES");
+ this->AllSections["Custom CMake Modules"] = sec;
+ sec->Append(cmDocumentationCustomModulesHeader[0]);
sectionHasHeader = true;
}
- this->CreateModuleDocsForDir(dir, this->CustomModulesSection);
+ this->CreateModuleDocsForDir
+ (dir, *this->AllSections["Custom CMake Modules"]);
}
}
- if(sectionHasHeader)
- {
- cmDocumentationEntry e = { 0, 0, 0 };
- this->CustomModulesSection.Append(e);
- }
return true;
}
//----------------------------------------------------------------------------
-void cmDocumentation::CreateModuleDocsForDir(cmsys::Directory& dir,
- cmSection &moduleSection)
+void cmDocumentation
+::CreateModuleDocsForDir(cmsys::Directory& dir,
+ cmDocumentationSection &moduleSection)
{
for(unsigned int i = 0; i < dir.GetNumberOfFiles(); ++i)
{
@@ -510,7 +482,7 @@ void cmDocumentation::CreateModuleDocsForDir(cmsys::Directory& dir,
//----------------------------------------------------------------------------
bool cmDocumentation::CreateSingleModule(const char* fname,
const char* moduleName,
- cmSection &moduleSection)
+ cmDocumentationSection &moduleSection)
{
std::ifstream fin(fname);
if(!fin)
@@ -585,8 +557,7 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
this->ModuleStrings.push_back(ptext);
char* pbrief = strcpy(new char[brief.length()+1], brief.c_str());
this->ModuleStrings.push_back(pbrief);
- cmDocumentationEntry e = { pname, pbrief, ptext };
- moduleSection.Append(e);
+ moduleSection.Append(pname, pbrief, ptext);
return true;
}
}
@@ -819,15 +790,18 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv)
void cmDocumentation::Print(Form f, std::ostream& os)
{
this->SetForm(f);
- Print(os);
+ this->Print(os);
}
//----------------------------------------------------------------------------
void cmDocumentation::Print(std::ostream& os)
{
- for(unsigned int i=0; i < this->Sections.size(); ++i)
+ for(unsigned int i=0; i < this->PrintSections.size(); ++i)
{
- this->CurrentFormatter->PrintSection(os,this->Sections[i], this->Names[i]);
+ std::string name = this->PrintSections[i]->
+ GetName((this->CurrentFormatter->GetForm()));
+ this->CurrentFormatter->PrintSection(os,*this->PrintSections[i],
+ name.c_str());
}
}
@@ -838,144 +812,106 @@ void cmDocumentation::SetName(const char* name)
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetNameSection(const cmDocumentationEntry* section)
-{
- this->NameSection.Set(0, section, 0);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::SetUsageSection(const cmDocumentationEntry* section)
-{
- this->UsageSection.Set(0, section, 0);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation
-::SetDescriptionSection(const cmDocumentationEntry* section)
-{
- this->DescriptionSection.Set(0, section, 0);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::SetOptionsSection(const cmDocumentationEntry* section)
-{
- this->OptionsSection.Set(0, section, cmDocumentationStandardOptions);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::SetCommandsSection(const cmDocumentationEntry* section)
+void cmDocumentation::SetSection(const char *name,
+ cmDocumentationSection *section)
{
- this->CommandsSection.Set(cmDocumentationCommandsHeader, section, 0);
+ if (this->AllSections.find(name) != this->AllSections.end())
+ {
+ delete this->AllSections[name];
+ }
+ this->AllSections[name] = section;
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetCompatCommandsSection(const cmDocumentationEntry*
- section)
+void cmDocumentation::SetSection(const char *name,
+ std::vector<cmDocumentationEntry> &docs)
{
- this->CompatCommandsSection.Set(cmDocumentationCommandsHeader, section, 0);
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
+ cmSystemTools::UpperCase(name).c_str());
+ sec->Append(docs);
+ this->SetSection(name,sec);
}
//----------------------------------------------------------------------------
-void cmDocumentation
-::SetPropertiesSection(const cmDocumentationEntry* section,
- cmProperty::ScopeType type)
+void cmDocumentation::SetSection(const char *name,
+ const char *docs[][3])
{
- switch(type)
- {
- case cmProperty::GLOBAL:
- this->GlobalPropertiesSection.Set(
- cmDocumentationGlobalPropertiesHeader, section, 0);
- break;
- case cmProperty::DIRECTORY:
- this->DirectoryPropertiesSection.Set(
- cmDocumentationDirectoryPropertiesHeader, section, 0);
- break;
- case cmProperty::TARGET:
- this->TargetPropertiesSection.Set(
- cmDocumentationTargetPropertiesHeader, section, 0);
- break;
- case cmProperty::TEST:
- this->TestPropertiesSection.Set(
- cmDocumentationTestPropertiesHeader, section, 0);
- break;
- case cmProperty::SOURCE_FILE:
- this->SourceFilePropertiesSection.Set(
- cmDocumentationSourceFilePropertiesHeader, section, 0);
- break;
- case cmProperty::VARIABLE:
- this->VariablePropertiesSection.Set(
- cmDocumentationVariablePropertiesHeader, section, 0);
- break;
- case cmProperty::CACHED_VARIABLE:
- this->CachedVariablePropertiesSection.Set(
- cmDocumentationCachedVariablePropertiesHeader, section, 0);
- break;
- default:
- break;
- }
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
+ cmSystemTools::UpperCase(name).c_str());
+ sec->Append(docs);
+ this->SetSection(name,sec);
}
//----------------------------------------------------------------------------
void cmDocumentation
-::SetGeneratorsSection(const cmDocumentationEntry* section)
+::SetSections(std::map<std::string,cmDocumentationSection *> &sections)
{
- this->GeneratorsSection.Set(cmDocumentationGeneratorsHeader, section, 0);
+ for (std::map<std::string,cmDocumentationSection *>::const_iterator
+ it = sections.begin(); it != sections.end(); ++it)
+ {
+ this->SetSection(it->first.c_str(),it->second);
+ }
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetSeeAlsoList(const cmDocumentationEntry* also)
+void cmDocumentation::SetSeeAlsoList(const char *data[][3])
{
- this->SeeAlsoSection.Clear();
+ cmDocumentationSection *sec =
+ new cmDocumentationSection("See Also", "SEE ALSO");
+ this->AllSections["See Also"] = sec;
this->SeeAlsoString = ".B ";
- for(const cmDocumentationEntry* i = also; i->brief; ++i)
+ int i = 0;
+ while(data[i][1])
{
- this->SeeAlsoString += i->brief;
- this->SeeAlsoString += (i+1)->brief? "(1), ":"(1)";
+ this->SeeAlsoString += data[i][1];
+ this->SeeAlsoString += data[i+1][1]? "(1), ":"(1)";
+ ++i;
}
- cmDocumentationEntry e = {0, 0, 0};
- e.brief = this->SeeAlsoString.c_str();
- this->SeeAlsoSection.Append(e);
- for(const cmDocumentationEntry* i = cmDocumentationStandardSeeAlso;
- i->brief; ++i)
- {
- this->SeeAlsoSection.Append(*i);
- }
- e.brief = 0;
- this->SeeAlsoSection.Append(e);
+ sec->Append(0,this->SeeAlsoString.c_str(),0);
+ sec->Append(cmDocumentationStandardSeeAlso);
}
//----------------------------------------------------------------------------
-bool cmDocumentation::PrintDocumentationSingle(std::ostream& os)
+bool cmDocumentation::PrintDocumentationGeneric(std::ostream& os,
+ const char *section)
{
- if(this->CommandsSection.IsEmpty())
+ if(this->AllSections.find(section) == this->AllSections.end())
{
- os << "Internal error: commands list is empty." << std::endl;
+ os << "Internal error: " << section << " list is empty." << std::endl;
return false;
}
if(this->CurrentArgument.length() == 0)
{
- os << "Argument --help-command needs a command name.\n";
+ os << "Required argument missing.\n";
return false;
}
- for(const cmDocumentationEntry* entry = this->CommandsSection.GetEntries();
- entry->brief; ++entry)
+ const std::vector<cmDocumentationEntry> &entries =
+ this->AllSections[section]->GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator ei =
+ entries.begin();
+ ei != entries.end(); ++ei)
{
- if(entry->name && this->CurrentArgument == entry->name)
+ if(this->CurrentArgument == ei->Name)
{
- this->PrintDocumentationCommand(os, entry);
+ this->PrintDocumentationCommand(os, *ei);
return true;
}
}
- for(const cmDocumentationEntry*
- entry = this->CompatCommandsSection.GetEntries();
- entry->brief;
- ++entry)
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool cmDocumentation::PrintDocumentationSingle(std::ostream& os)
+{
+ if (this->PrintDocumentationGeneric(os,"Commands"))
{
- if(entry->name && this->CurrentArgument == entry->name)
- {
- this->PrintDocumentationCommand(os, entry);
- return true;
- }
+ return true;
+ }
+ if (this->PrintDocumentationGeneric(os,"Compatibility Commands"))
+ {
+ return true;
}
// Argument was not a command. Complain.
@@ -1028,9 +964,10 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
if(!moduleName.empty()
&& this->CreateSingleModule(moduleName.c_str(),
this->CurrentArgument.c_str(),
- this->ModulesSection))
+ *this->AllSections["Modules"]))
{
- this->PrintDocumentationCommand(os, this->ModulesSection.GetEntries());
+ this->PrintDocumentationCommand
+ (os, this->AllSections["Modules"]->GetEntries()[0]);
os << "\n Defined in: ";
os << moduleName << "\n";
return true;
@@ -1044,135 +981,53 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationSingleProperty(std::ostream& os)
{
- if(this->GlobalPropertiesSection.IsEmpty())
- {
- os << "Internal error: properties list is empty." << std::endl;
- return false;
- }
- if(this->CurrentArgument.length() == 0)
- {
- os << "Argument --help-property needs a property name.\n";
- return false;
- }
-
- for(std::map<cmProperty::ScopeType, cmSection*>::const_iterator
- sectionIt = this->PropertySections.begin();
- sectionIt != this->PropertySections.end();
- ++sectionIt)
- {
- for(const cmDocumentationEntry*
- entry = sectionIt->second->GetEntries(); entry->brief; ++entry)
- {
- if(entry->name && this->CurrentArgument == entry->name)
- {
- this->PrintDocumentationCommand(os, entry);
- return true;
- }
- }
- }
- // Argument was not a command. Complain.
- os << "Argument \"" << this->CurrentArgument.c_str()
- << "\" to --help-property is not a CMake property. "
- << "Use --help-property-list to see all properties.\n";
- return false;
-}
-
-//----------------------------------------------------------------------------
-bool cmDocumentation::PrintDocumentationList(std::ostream& os)
-{
- if(this->CommandsSection.IsEmpty())
+ if (this->PrintDocumentationGeneric(os,"Properties of Global Scope"))
{
- os << "Internal error: commands list is empty." << std::endl;
- return false;
+ return true;
}
- for(const cmDocumentationEntry* entry = this->CommandsSection.GetEntries();
- entry->brief; ++entry)
+ if (this->PrintDocumentationGeneric(os,"Properties on Directories"))
{
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
+ return true;
}
- os << "\nCompatibility commands:" << std::endl;
- for(const cmDocumentationEntry*
- entry = this->CompatCommandsSection.GetEntries();
- entry->brief;
- ++entry)
+ if (this->PrintDocumentationGeneric(os,"Properties on Targets"))
{
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
- }
- return true;
-}
-
-//----------------------------------------------------------------------------
-bool cmDocumentation::PrintPropertyList(std::ostream& os)
-{
- if(this->GlobalPropertiesSection.IsEmpty())
- {
- os << "Internal error: properties list is empty." << std::endl;
- return false;
+ return true;
}
- for(const cmDocumentationEntry*
- entry = this->GlobalPropertiesSection.GetEntries();
- entry->brief;
- ++entry)
+ if (this->PrintDocumentationGeneric(os,"Properties on Tests"))
{
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
+ return true;
}
-
- for(std::map<cmProperty::ScopeType, cmSection*>::const_iterator
- sectionIt = this->PropertySections.begin();
- sectionIt != this->PropertySections.end();
- ++sectionIt)
+ if (this->PrintDocumentationGeneric(os,"Properties on Source Files"))
{
- for(const cmDocumentationEntry*
- entry = sectionIt->second->GetEntries(); entry->brief; ++entry)
- {
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
- }
+ return true;
}
- return true;
+ // Argument was not a command. Complain.
+ os << "Argument \"" << this->CurrentArgument.c_str()
+ << "\" to --help-property is not a CMake property. "
+ << "Use --help-property-list to see all properties.\n";
+ return false;
}
//----------------------------------------------------------------------------
-bool cmDocumentation::PrintModuleList(std::ostream& os)
+bool cmDocumentation::PrintDocumentationList(std::ostream& os,
+ const char *section)
{
- this->CreateCustomModulesSection();
- this->CreateModulesSection();
- if(this->ModulesSection.IsEmpty())
+ if(this->AllSections.find(section) == this->AllSections.end())
{
- os << "Internal error: modules list is empty." << std::endl;
+ os << "Internal error: " << section << " list is empty." << std::endl;
return false;
}
- for(const cmDocumentationEntry* entry = this->ModulesSection.GetEntries();
- entry->brief; ++entry)
- {
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
- }
- if(!this->CustomModulesSection.IsEmpty())
+ const std::vector<cmDocumentationEntry> &entries =
+ this->AllSections[section]->GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator ei =
+ entries.begin();
+ ei != entries.end(); ++ei)
{
- os << "\nCUSTOM MODULES\n" << std::endl;
- for(const cmDocumentationEntry*
- entry = this->CustomModulesSection.GetEntries(); entry->brief; ++entry)
+ if(ei->Name.size())
{
- if(entry->name)
- {
- os << entry->name << std::endl;
- }
+ os << ei->Name << std::endl;
}
}
return true;
@@ -1181,7 +1036,10 @@ bool cmDocumentation::PrintModuleList(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationUsage(std::ostream& os)
{
- this->CreateUsageDocumentation();
+ this->ClearSections();
+ this->AddSectionToPrint("Usage");
+ this->AddSectionToPrint("Options");
+ this->AddSectionToPrint("Generators");
this->Print(os);
return true;
}
@@ -1199,8 +1057,13 @@ bool cmDocumentation::PrintDocumentationFull(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationModules(std::ostream& os)
{
- this->CreateModulesDocumentation();
- this->CurrentFormatter->PrintHeader(GetNameString(), os);
+ this->ClearSections();
+ this->CreateModulesSection();
+ this->AddSectionToPrint("Description");
+ this->AddSectionToPrint("Modules");
+ this->AddSectionToPrint("Copyright");
+ this->AddSectionToPrint("See Also");
+ this->CurrentFormatter->PrintHeader(this->GetNameString(), os);
this->Print(os);
this->CurrentFormatter->PrintFooter(os);
return true;
@@ -1209,8 +1072,14 @@ bool cmDocumentation::PrintDocumentationModules(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os)
{
- this->CreateCustomModulesDocumentation();
- this->CurrentFormatter->PrintHeader(GetNameString(), os);
+ this->ClearSections();
+ this->CreateCustomModulesSection();
+ this->AddSectionToPrint("Description");
+ this->AddSectionToPrint("Custom Modules");
+ this->AddSectionToPrint("Copyright");
+ this->AddSectionToPrint("See Also");
+
+ this->CurrentFormatter->PrintHeader(this->GetNameString(), os);
this->Print(os);
this->CurrentFormatter->PrintFooter(os);
return true;
@@ -1219,8 +1088,16 @@ bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationProperties(std::ostream& os)
{
- this->CreatePropertiesDocumentation();
- this->CurrentFormatter->PrintHeader(GetNameString(), os);
+ this->ClearSections();
+ this->AddSectionToPrint("Properties Description");
+ this->AddSectionToPrint("Properties of Global Scope");
+ this->AddSectionToPrint("Properties on Directories");
+ this->AddSectionToPrint("Properties on Targets");
+ this->AddSectionToPrint("Properties on Tests");
+ this->AddSectionToPrint("Properties on Source Files");
+ this->AddSectionToPrint("Copyright");
+ this->AddSectionToPrint("Standard See Also");
+ this->CurrentFormatter->PrintHeader(this->GetNameString(), os);
this->Print(os);
this->CurrentFormatter->PrintFooter(os);
return true;
@@ -1229,8 +1106,11 @@ bool cmDocumentation::PrintDocumentationProperties(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationCurrentCommands(std::ostream& os)
{
- this->CreateCurrentCommandsDocumentation();
- this->CurrentFormatter->PrintHeader(GetNameString(), os);
+ this->ClearSections();
+ this->AddSectionToPrint("Commands");
+ this->AddSectionToPrint("Copyright");
+ this->AddSectionToPrint("Standard See Also");
+ this->CurrentFormatter->PrintHeader(this->GetNameString(), os);
this->Print(os);
this->CurrentFormatter->PrintFooter(os);
return true;
@@ -1239,7 +1119,11 @@ bool cmDocumentation::PrintDocumentationCurrentCommands(std::ostream& os)
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentationCompatCommands(std::ostream& os)
{
- this->CreateCompatCommandsDocumentation();
+ this->ClearSections();
+ this->AddSectionToPrint("Compatibility Commands Description");
+ this->AddSectionToPrint("Compatibility Commands");
+ this->AddSectionToPrint("Copyright");
+ this->AddSectionToPrint("Standard See Also");
this->CurrentFormatter->PrintHeader(GetNameString(), os);
this->Print(os);
this->CurrentFormatter->PrintFooter(os);
@@ -1247,26 +1131,18 @@ bool cmDocumentation::PrintDocumentationCompatCommands(std::ostream& os)
}
//----------------------------------------------------------------------------
-void cmDocumentation::PrintDocumentationCommand(std::ostream& os,
- const cmDocumentationEntry* entry)
+void cmDocumentation
+::PrintDocumentationCommand(std::ostream& os,
+ const cmDocumentationEntry &entry)
{
- cmDocumentationEntry singleCommandSection[3] =
- {
- {entry->name, entry->brief, entry->full},
- {0,0,0}
- };
+ cmDocumentationSection *sec = new cmDocumentationSection("","");
+ sec->Append(entry);
+ this->AllSections["temp"] = sec;
this->ClearSections();
- this->AddSection(0, &singleCommandSection[0]);
+ this->AddSectionToPrint("temp");
this->Print(os);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::CreateUsageDocumentation()
-{
- this->ClearSections();
- this->AddSection(this->UsageSection);
- this->AddSection(this->OptionsSection);
- this->AddSection(this->GeneratorsSection);
+ this->AllSections.erase("temp");
+ delete sec;
}
//----------------------------------------------------------------------------
@@ -1275,109 +1151,63 @@ void cmDocumentation::CreateFullDocumentation()
this->ClearSections();
this->CreateCustomModulesSection();
this->CreateModulesSection();
- this->AddSection(this->NameSection);
- this->AddSection(this->UsageSection);
- this->AddSection(this->DescriptionSection);
- this->AddSection(this->OptionsSection);
- this->AddSection(this->GeneratorsSection);
- this->AddSection(this->CommandsSection);
- this->AddSection(this->CompatCommandsSection);
- this->AddSection(this->ModulesSection);
- this->AddSection(this->GlobalPropertiesSection);
- this->AddSection(this->DirectoryPropertiesSection);
- this->AddSection(this->TargetPropertiesSection);
- this->AddSection(this->TestPropertiesSection);
- this->AddSection(this->SourceFilePropertiesSection);
- this->AddSection(this->VariablePropertiesSection);
- this->AddSection(this->CachedVariablePropertiesSection);
-
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
+
+ std::set<std::string> emitted;
+ this->AddSectionToPrint("Name");
+ emitted.insert("Name");
+ this->AddSectionToPrint("Usage");
+ emitted.insert("Usage");
+ this->AddSectionToPrint("Description");
+ emitted.insert("Description");
+ this->AddSectionToPrint("Options");
+ emitted.insert("Options");
+ this->AddSectionToPrint("Generators");
+ emitted.insert("Generators");
+ this->AddSectionToPrint("Commands");
+ emitted.insert("Commands");
+
+ this->AddSectionToPrint("Properties Description");
+ emitted.insert("Properties Description");
+ this->AddSectionToPrint("Properties of Global Scope");
+ emitted.insert("Properties of Global Scope");
+ this->AddSectionToPrint("Properties on Directories");
+ emitted.insert("Properties on Directories");
+ this->AddSectionToPrint("Properties on Targets");
+ emitted.insert("Properties on Targets");
+ this->AddSectionToPrint("Properties on Tests");
+ emitted.insert("Properties on Tests");
+ this->AddSectionToPrint("Properties on Source Files");
+ emitted.insert("Properties on Source Files");
+
+ emitted.insert("Copyright");
+ emitted.insert("See Also");
+ emitted.insert("Standard See Also");
+ emitted.insert("Author");
+
+ // add any sections not yet written out, or to be written out
+ for (std::map<std::string, cmDocumentationSection*>::iterator i =
+ this->AllSections.begin();
+ i != this->AllSections.end(); ++i)
+ {
+ if (emitted.find(i->first) == emitted.end())
+ {
+ this->AddSectionToPrint(i->first.c_str());
+ }
+ }
+
+ this->AddSectionToPrint("Copyright");
if(this->CurrentFormatter->GetForm() == ManForm)
{
- this->AddSection(this->SeeAlsoSection);
- this->AddSection(this->AuthorSection.GetName(ManForm),
- cmDocumentationAuthor);
+ this->AddSectionToPrint("See Also");
+ this->AddSectionToPrint("Author");
}
else
{
- this->AddSection(this->SeeAlsoSection.GetName(TextForm),
- cmDocumentationStandardSeeAlso);
+ this->AddSectionToPrint("Standard See Also");
}
}
-void cmDocumentation::CreateCurrentCommandsDocumentation()
-{
- this->ClearSections();
- this->AddSection(this->CommandsSection);
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
- this->AddSection(this->SeeAlsoSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationStandardSeeAlso);
-}
-
-void cmDocumentation::CreateCompatCommandsDocumentation()
-{
- this->ClearSections();
- this->AddSection(this->DescriptionSection.GetName(
- this->CurrentFormatter->GetForm()),
- cmCompatCommandsDocumentationDescription);
- this->AddSection(this->CompatCommandsSection);
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
- this->AddSection(this->SeeAlsoSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationStandardSeeAlso);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::CreateModulesDocumentation()
-{
- this->ClearSections();
- this->CreateModulesSection();
- this->AddSection(this->DescriptionSection.GetName(
- this->CurrentFormatter->GetForm()), cmModulesDocumentationDescription);
- this->AddSection(this->ModulesSection);
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
- this->AddSection(this->SeeAlsoSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationStandardSeeAlso);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::CreateCustomModulesDocumentation()
-{
- this->ClearSections();
- this->CreateCustomModulesSection();
- this->AddSection(this->DescriptionSection.GetName(
- this->CurrentFormatter->GetForm()),
- cmCustomModulesDocumentationDescription);
- this->AddSection(this->CustomModulesSection);
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
- this->AddSection(this->SeeAlsoSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationStandardSeeAlso);
-}
-
-//----------------------------------------------------------------------------
-void cmDocumentation::CreatePropertiesDocumentation()
-{
- this->ClearSections();
- this->AddSection(this->DescriptionSection.GetName(
- this->CurrentFormatter->GetForm()), cmPropertiesDocumentationDescription);
- this->AddSection(this->GlobalPropertiesSection);
- this->AddSection(this->DirectoryPropertiesSection);
- this->AddSection(this->TargetPropertiesSection);
- this->AddSection(this->TestPropertiesSection);
- this->AddSection(this->SourceFilePropertiesSection);
- this->AddSection(this->VariablePropertiesSection);
- this->AddSection(this->CachedVariablePropertiesSection);
- this->AddSection(this->CopyrightSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationCopyright);
- this->AddSection(this->SeeAlsoSection.GetName(
- this->CurrentFormatter->GetForm()), cmDocumentationStandardSeeAlso);
-}
-
//----------------------------------------------------------------------------
void cmDocumentation::SetForm(Form f)
{
@@ -1400,37 +1230,6 @@ void cmDocumentation::SetForm(Form f)
//----------------------------------------------------------------------------
-void cmDocumentation::cmSection::Set(const cmDocumentationEntry* header,
- const cmDocumentationEntry* section,
- const cmDocumentationEntry* footer)
-{
- this->Entries.erase(this->Entries.begin(), this->Entries.end());
- if(header)
- {
- for(const cmDocumentationEntry* op = header; op->brief; ++op)
- {
- this->Entries.push_back(*op);
- }
- }
- if(section)
- {
- for(const cmDocumentationEntry* op = section; op->brief; ++op)
- {
- this->Entries.push_back(*op);
- }
- }
- if(footer)
- {
- for(const cmDocumentationEntry* op = footer; op->brief; ++op)
- {
- this->Entries.push_back(*op);
- }
- }
- cmDocumentationEntry empty = {0,0,0};
- this->Entries.push_back(empty);
-}
-
-//----------------------------------------------------------------------------
const char* cmDocumentation::GetNameString() const
{
if(this->NameString.length() > 0)
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index c6f5444..0de0fa2 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -24,7 +24,7 @@
#include "cmDocumentationFormatterMan.h"
#include "cmDocumentationFormatterText.h"
#include "cmDocumentationFormatterUsage.h"
-
+#include "cmDocumentationSection.h"
namespace cmsys
{
@@ -62,78 +62,16 @@ public:
/** Set the program name for standard document generation. */
void SetName(const char* name);
- /** Set the program name section for standard document
- * generation. */
- void SetNameSection(const cmDocumentationEntry*);
-
- /** Set the program usage for standard document generation. */
- void SetUsageSection(const cmDocumentationEntry*);
-
- /** Set the program description for standard document generation. */
- void SetDescriptionSection(const cmDocumentationEntry*);
-
- /** Set the program options for standard document generation. */
- void SetOptionsSection(const cmDocumentationEntry*);
-
- /** Set the listfile commands for standard document generation. */
- void SetCommandsSection(const cmDocumentationEntry*);
-
- /** Set the listfile compat. commands for standard document generation. */
- void SetCompatCommandsSection(const cmDocumentationEntry*);
-
- /** Set the global properties for standard document generation. */
- void SetPropertiesSection(const cmDocumentationEntry*,
- cmProperty::ScopeType type);
-
- /** Set the generator descriptions for standard document generation. */
- void SetGeneratorsSection(const cmDocumentationEntry*);
-
- /** Set the see-also list of references to the other tools. */
- void SetSeeAlsoList(const cmDocumentationEntry*);
-
- // Low-level interface for custom documents:
- /** Internal class representing a section of the documentation.
- * Cares e.g. for the different section titles in the different
- * output formats.
- */
- class cmSection
- {
- public:
- /** Create a cmSection, with a special name for man-output mode. */
- cmSection(const char* name, const char* manName)
- :Name(name), ManName(manName) {}
-
- /** Has any content been added to this section or is it empty ? */
- bool IsEmpty() const
- { return this->Entries.empty(); }
-
- /** Clear contents. */
- void Clear()
- { this->Entries.clear(); }
-
- /** Return the name of this section for the given output form. */
- const char* GetName(Form form) const
- { return (form==ManForm?this->ManName.c_str():this->Name.c_str()); }
-
- /** Return a pointer to the first entry of this section. */
- const cmDocumentationEntry *GetEntries() const
- { return this->Entries.empty()?&this->EmptySection:&this->Entries[0];}
-
- /** Append an entry to this section. */
- void Append(const cmDocumentationEntry& entry)
- { this->Entries.push_back(entry); }
-
- /** Set the contents of this section. */
- void Set(const cmDocumentationEntry* header,
- const cmDocumentationEntry* section,
- const cmDocumentationEntry* footer);
-
- private:
- std::string Name;
- std::string ManName;
- std::vector<cmDocumentationEntry> Entries;
- static const cmDocumentationEntry EmptySection;
- };
+ /** Set a section of the documentation. Typical sections include Name,
+ Usage, Description, Options, SeeAlso */
+ void SetSection(const char *sectionName,
+ cmDocumentationSection *section);
+ void SetSection(const char *sectionName,
+ std::vector<cmDocumentationEntry> &docs);
+ void SetSection(const char *sectionName,
+ const char *docs[][3]);
+ void SetSections(std::map<std::string,cmDocumentationSection *>
+ &sections);
/**
* Print documentation in the given form. All previously added
@@ -148,14 +86,12 @@ public:
void Print(std::ostream& os);
/**
- * Add a section of documentation. The cmDocumentationEntry pointer
- * should point at an array terminated by an all zero ({0,0,0})
- * entry. This can be used to generate custom help documents.
+ * Add a section of documentation. This can be used to generate custom help
+ * documents.
*/
- void AddSection(const char* name, const cmDocumentationEntry* d);
-
- /** Convenience function, does the same as above */
- void AddSection(const cmSection& section);
+ void AddSectionToPrint(const char *section);
+
+ void SetSeeAlsoList(const char *data[][3]);
/** Clear all previously added sections of help. */
void ClearSections();
@@ -172,16 +108,18 @@ private:
void SetForm(Form f);
bool CreateSingleModule(const char* fname,
- const char* moduleName,
- cmSection &moduleSection);
- void CreateModuleDocsForDir(cmsys::Directory& dir, cmSection &moduleSection);
+ const char* moduleName,
+ cmDocumentationSection &sec);
+ void CreateModuleDocsForDir(cmsys::Directory& dir,
+ cmDocumentationSection &moduleSection);
bool CreateModulesSection();
bool CreateCustomModulesSection();
+ void CreateFullDocumentation();
+
bool PrintCopyright(std::ostream& os);
bool PrintVersion(std::ostream& os);
- bool PrintDocumentationList(std::ostream& os);
- bool PrintModuleList(std::ostream& os);
- bool PrintPropertyList(std::ostream& os);
+ bool PrintDocumentationGeneric(std::ostream& os, const char *section);
+ bool PrintDocumentationList(std::ostream& os, const char *section);
bool PrintDocumentationSingle(std::ostream& os);
bool PrintDocumentationSingleModule(std::ostream& os);
bool PrintDocumentationSingleProperty(std::ostream& os);
@@ -193,52 +131,21 @@ private:
bool PrintDocumentationCurrentCommands(std::ostream& os);
bool PrintDocumentationCompatCommands(std::ostream& os);
void PrintDocumentationCommand(std::ostream& os,
- const cmDocumentationEntry* entry);
+ const cmDocumentationEntry &entry);
- void CreateUsageDocumentation();
- void CreateFullDocumentation();
- void CreateCurrentCommandsDocumentation();
- void CreateCompatCommandsDocumentation();
- void CreateModulesDocumentation();
- void CreateCustomModulesDocumentation();
- void CreatePropertiesDocumentation();
- void SetSection(const cmDocumentationEntry* header,
- const cmDocumentationEntry* section,
- const cmDocumentationEntry* footer,
- std::vector<cmDocumentationEntry>&);
const char* GetNameString() const;
bool IsOption(const char* arg) const;
std::string NameString;
- cmSection NameSection;
- cmSection UsageSection;
- cmSection DescriptionSection;
- cmSection OptionsSection;
- cmSection CommandsSection;
- cmSection CompatCommandsSection;
- cmSection ModulesSection;
- cmSection CustomModulesSection;
- cmSection GeneratorsSection;
- cmSection SeeAlsoSection;
- cmSection CopyrightSection;
- cmSection AuthorSection;
- cmSection GlobalPropertiesSection;
- cmSection DirectoryPropertiesSection;
- cmSection TargetPropertiesSection;
- cmSection TestPropertiesSection;
- cmSection SourceFilePropertiesSection;
- cmSection VariablePropertiesSection;
- cmSection CachedVariablePropertiesSection;
- std::map<cmProperty::ScopeType, cmSection*> PropertySections;
+ std::map<std::string,cmDocumentationSection*> AllSections;
std::string SeeAlsoString;
std::string CMakeRoot;
std::string CMakeModulePath;
std::set<std::string> ModulesFound;
std::vector< char* > ModuleStrings;
- std::vector< const char* > Names;
- std::vector< const cmDocumentationEntry* > Sections;
+ std::vector<const cmDocumentationSection *> PrintSections;
std::string CurrentArgument;
struct RequestedHelpItem
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index c0bc646..8ffd064 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -39,6 +39,8 @@ public:
enum Form { TextForm, HTMLForm, ManForm, UsageForm };
};
+class cmDocumentationSection;
+
/** Base class for printing the documentation in the various supported
formats. */
class cmDocumentationFormatter
@@ -53,7 +55,7 @@ public:
virtual void PrintHeader(const char* /*name*/, std::ostream& /*os*/) {}
virtual void PrintFooter(std::ostream& /*os*/) {}
virtual void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
+ const cmDocumentationSection& section,
const char* name) = 0;
virtual void PrintPreformatted(std::ostream& os, const char* text) = 0;
virtual void PrintParagraph(std::ostream& os, const char* text) = 0;
diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx
index 16823b1..3451183 100644
--- a/Source/cmDocumentationFormatterHTML.cxx
+++ b/Source/cmDocumentationFormatterHTML.cxx
@@ -15,6 +15,7 @@
=========================================================================*/
#include "cmDocumentationFormatterHTML.h"
+#include "cmDocumentationSection.h"
//----------------------------------------------------------------------------
static bool cmDocumentationIsHyperlinkChar(char c)
@@ -31,25 +32,21 @@ static bool cmDocumentationIsHyperlinkChar(char c)
static void cmDocumentationPrintHTMLChar(std::ostream& os, char c)
{
// Use an escape sequence if necessary.
- static cmDocumentationEntry escapes[] =
- {
- {"<", "&lt;", 0},
- {">", "&gt;", 0},
- {"&", "&amp;", 0},
- {"\n", "<br>", 0},
- {0,0,0}
- };
- for(const cmDocumentationEntry* op = escapes; op->name; ++op)
+ std::map<char,std::string> escapes;
+ escapes['<'] = "&lt;";
+ escapes['>'] = "&gt;";
+ escapes['&'] = "&amp;";
+ escapes['\n'] = "<br>";
+
+ if (escapes.find(c) == escapes.end())
{
- if(op->name[0] == c)
- {
- os << op->brief;
- return;
- }
+ // No escape sequence is needed.
+ os << c;
+ return;
}
-
- // No escape sequence is needed.
- os << c;
+
+ os << escapes[c];
+ return;
}
//----------------------------------------------------------------------------
@@ -88,34 +85,38 @@ cmDocumentationFormatterHTML::cmDocumentationFormatterHTML()
{
}
-void cmDocumentationFormatterHTML::PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name)
+void cmDocumentationFormatterHTML
+::PrintSection(std::ostream& os,
+ const cmDocumentationSection &section,
+ const char* name)
{
if(name)
{
os << "<h2>" << name << "</h2>\n";
}
- if(!section) { return; }
- for(const cmDocumentationEntry* op = section; op->brief;)
+
+ const std::vector<cmDocumentationEntry> &entries =
+ section.GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
+ op != entries.end();)
{
- if(op->name)
+ if(op->Name.size())
{
os << "<ul>\n";
- for(;op->name;++op)
+ for(;op != entries.end() && op->Name.size(); ++op)
{
os << " <li>\n";
- if(op->name[0])
+ if(op->Name.size())
{
os << " <b><code>";
- this->PrintHTMLEscapes(os, op->name);
+ this->PrintHTMLEscapes(os, op->Name.c_str());
os << "</code></b>: ";
}
- this->PrintHTMLEscapes(os, op->brief);
- if(op->full)
+ this->PrintHTMLEscapes(os, op->Brief.c_str());
+ if(op->Full.size())
{
os << "<br>\n ";
- this->PrintFormatted(os, op->full);
+ this->PrintFormatted(os, op->Full.c_str());
}
os << "\n";
os << " </li>\n";
@@ -124,7 +125,7 @@ void cmDocumentationFormatterHTML::PrintSection(std::ostream& os,
}
else
{
- this->PrintFormatted(os, op->brief);
+ this->PrintFormatted(os, op->Brief.c_str());
os << "\n";
++op;
}
diff --git a/Source/cmDocumentationFormatterHTML.h b/Source/cmDocumentationFormatterHTML.h
index e5a4a9a..58c2437 100644
--- a/Source/cmDocumentationFormatterHTML.h
+++ b/Source/cmDocumentationFormatterHTML.h
@@ -33,7 +33,7 @@ public:
virtual void PrintHeader(const char* name, std::ostream& os);
virtual void PrintFooter(std::ostream& os);
virtual void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
+ const cmDocumentationSection& section,
const char* name);
virtual void PrintPreformatted(std::ostream& os, const char* text);
virtual void PrintParagraph(std::ostream& os, const char* text);
diff --git a/Source/cmDocumentationFormatterMan.cxx b/Source/cmDocumentationFormatterMan.cxx
index 0a16b9f..d34a0d4 100644
--- a/Source/cmDocumentationFormatterMan.cxx
+++ b/Source/cmDocumentationFormatterMan.cxx
@@ -16,6 +16,7 @@
=========================================================================*/
#include "cmDocumentationFormatterMan.h"
+#include "cmDocumentationSection.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
@@ -26,28 +27,32 @@ cmDocumentationFormatterMan::cmDocumentationFormatterMan()
{
}
-void cmDocumentationFormatterMan::PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name)
+void cmDocumentationFormatterMan
+::PrintSection(std::ostream& os,
+ const cmDocumentationSection &section,
+ const char* name)
{
if(name)
{
os << ".SH " << name << "\n";
}
- if(!section) { return; }
- for(const cmDocumentationEntry* op = section; op->brief; ++op)
+
+ const std::vector<cmDocumentationEntry> &entries =
+ section.GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
+ op != entries.end(); ++op)
{
- if(op->name)
+ if(op->Name.size())
{
os << ".TP\n"
- << ".B " << (op->name[0]?op->name:"*") << "\n";
- this->PrintFormatted(os, op->brief);
- this->PrintFormatted(os, op->full);
+ << ".B " << (op->Name.size()?op->Name.c_str():"*") << "\n";
+ this->PrintFormatted(os, op->Brief.c_str());
+ this->PrintFormatted(os, op->Full.c_str());
}
else
{
os << ".PP\n";
- this->PrintFormatted(os, op->brief);
+ this->PrintFormatted(os, op->Brief.c_str());
}
}
}
diff --git a/Source/cmDocumentationFormatterMan.h b/Source/cmDocumentationFormatterMan.h
index 17151c6..c0b9968 100644
--- a/Source/cmDocumentationFormatterMan.h
+++ b/Source/cmDocumentationFormatterMan.h
@@ -32,7 +32,7 @@ public:
virtual void PrintHeader(const char* name, std::ostream& os);
virtual void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
+ const cmDocumentationSection& section,
const char* name);
virtual void PrintPreformatted(std::ostream& os, const char* text);
virtual void PrintParagraph(std::ostream& os, const char* text);
diff --git a/Source/cmDocumentationFormatterText.cxx b/Source/cmDocumentationFormatterText.cxx
index 4ab2695..ca22166 100644
--- a/Source/cmDocumentationFormatterText.cxx
+++ b/Source/cmDocumentationFormatterText.cxx
@@ -16,6 +16,7 @@
=========================================================================*/
#include "cmDocumentationFormatterText.h"
+#include "cmDocumentationSection.h"
cmDocumentationFormatterText::cmDocumentationFormatterText()
:cmDocumentationFormatter()
@@ -24,9 +25,10 @@ cmDocumentationFormatterText::cmDocumentationFormatterText()
{
}
-void cmDocumentationFormatterText::PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name)
+void cmDocumentationFormatterText
+::PrintSection(std::ostream& os,
+ const cmDocumentationSection &section,
+ const char* name)
{
if(name)
{
@@ -35,27 +37,27 @@ void cmDocumentationFormatterText::PrintSection(std::ostream& os,
"---------------------------------------\n";
os << name << "\n\n";
}
- if(!section) { return; }
- for(const cmDocumentationEntry* op = section; op->brief; ++op)
+
+ const std::vector<cmDocumentationEntry> &entries =
+ section.GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
+ op != entries.end(); ++op)
{
- if(op->name)
+ if(op->Name.size())
{
- if(op->name[0])
- {
- os << " " << op->name << "\n";
- }
+ os << " " << op->Name << "\n";
this->TextIndent = " ";
- this->PrintFormatted(os, op->brief);
- if(op->full)
+ this->PrintFormatted(os, op->Brief.c_str());
+ if(op->Full.size())
{
os << "\n";
- this->PrintFormatted(os, op->full);
+ this->PrintFormatted(os, op->Full.c_str());
}
}
else
{
this->TextIndent = "";
- this->PrintFormatted(os, op->brief);
+ this->PrintFormatted(os, op->Brief.c_str());
}
os << "\n";
}
diff --git a/Source/cmDocumentationFormatterText.h b/Source/cmDocumentationFormatterText.h
index f7db277..95973c2 100644
--- a/Source/cmDocumentationFormatterText.h
+++ b/Source/cmDocumentationFormatterText.h
@@ -31,7 +31,7 @@ public:
{ return cmDocumentationEnums::TextForm;}
virtual void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
+ const cmDocumentationSection& section,
const char* name);
virtual void PrintPreformatted(std::ostream& os, const char* text);
virtual void PrintParagraph(std::ostream& os, const char* text);
diff --git a/Source/cmDocumentationFormatterUsage.cxx b/Source/cmDocumentationFormatterUsage.cxx
index d5f315a..91929da 100644
--- a/Source/cmDocumentationFormatterUsage.cxx
+++ b/Source/cmDocumentationFormatterUsage.cxx
@@ -16,46 +16,51 @@
=========================================================================*/
#include "cmDocumentationFormatterUsage.h"
+#include "cmDocumentationSection.h"
cmDocumentationFormatterUsage::cmDocumentationFormatterUsage()
:cmDocumentationFormatterText()
{
}
-void cmDocumentationFormatterUsage::PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
- const char* name)
+void cmDocumentationFormatterUsage
+::PrintSection(std::ostream& os,
+ const cmDocumentationSection &section,
+ const char* name)
{
if(name)
{
os << name << "\n";
}
- if(!section) { return; }
- for(const cmDocumentationEntry* op = section; op->brief; ++op)
+
+ const std::vector<cmDocumentationEntry> &entries =
+ section.GetEntries();
+ for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
+ op != entries.end(); ++op)
{
- if(op->name)
+ if(op->Name.size())
{
- os << " " << op->name;
+ os << " " << op->Name;
this->TextIndent = " ";
int align = static_cast<int>(strlen(this->TextIndent))-4;
- for(int i = static_cast<int>(strlen(op->name)); i < align; ++i)
+ for(int i = static_cast<int>(op->Name.size()); i < align; ++i)
{
os << " ";
}
- if ( strlen(op->name) > strlen(this->TextIndent)-4 )
+ if (op->Name.size() > strlen(this->TextIndent)-4 )
{
os << "\n";
os.write(this->TextIndent, strlen(this->TextIndent)-2);
}
os << "= ";
- this->PrintColumn(os, op->brief);
+ this->PrintColumn(os, op->Brief.c_str());
os << "\n";
}
else
{
os << "\n";
this->TextIndent = "";
- this->PrintFormatted(os, op->brief);
+ this->PrintFormatted(os, op->Brief.c_str());
}
}
os << "\n";
diff --git a/Source/cmDocumentationFormatterUsage.h b/Source/cmDocumentationFormatterUsage.h
index 620e3b9..0d10b46 100644
--- a/Source/cmDocumentationFormatterUsage.h
+++ b/Source/cmDocumentationFormatterUsage.h
@@ -29,7 +29,7 @@ public:
{ return cmDocumentationEnums::UsageForm;}
virtual void PrintSection(std::ostream& os,
- const cmDocumentationEntry* section,
+ const cmDocumentationSection& section,
const char* name);
};
diff --git a/Source/cmDocumentationSection.cxx b/Source/cmDocumentationSection.cxx
new file mode 100644
index 0000000..c4a4edf
--- /dev/null
+++ b/Source/cmDocumentationSection.cxx
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmDocumentationSection.h"
+
+
+//----------------------------------------------------------------------------
+void cmDocumentationSection::Append(const char *data[][3])
+{
+ int i = 0;
+ while(data[i][1])
+ {
+ this->Entries.push_back(cmDocumentationEntry(data[i][0],
+ data[i][1],
+ data[i][2]));
+ data += 1;
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentationSection::Append(const char *n, const char *b,
+ const char *f)
+{
+ this->Entries.push_back(cmDocumentationEntry(n,b,f));
+}
+
+#if 0
+//----------------------------------------------------------------------------
+void cmDocumentationSection::Set(const cmDocumentationEntry* header,
+ const cmDocumentationEntry* section,
+ const cmDocumentationEntry* footer)
+{
+ this->Entries.erase(this->Entries.begin(), this->Entries.end());
+ if(header)
+ {
+ for(const cmDocumentationEntry* op = header; op->brief; ++op)
+ {
+ this->Entries.push_back(*op);
+ }
+ }
+ if(section)
+ {
+ for(const cmDocumentationEntry* op = section; op->brief; ++op)
+ {
+ this->Entries.push_back(*op);
+ }
+ }
+ if(footer)
+ {
+ for(const cmDocumentationEntry* op = footer; op->brief; ++op)
+ {
+ this->Entries.push_back(*op);
+ }
+ }
+ cmDocumentationEntry empty = {0,0,0};
+ this->Entries.push_back(empty);
+}
+#endif
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
new file mode 100644
index 0000000..60e735b
--- /dev/null
+++ b/Source/cmDocumentationSection.h
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef _cmDocumentationSection_h
+#define _cmDocumentationSection_h
+
+#include "cmStandardIncludes.h"
+#include "cmDocumentationFormatter.h"
+
+// Low-level interface for custom documents:
+/** Internal class representing a section of the documentation.
+ * Cares e.g. for the different section titles in the different
+ * output formats.
+ */
+class cmDocumentationSection
+{
+public:
+ /** Create a cmSection, with a special name for man-output mode. */
+ cmDocumentationSection(const char* name, const char* manName)
+ :Name(name), ManName(manName) {}
+
+ /** Has any content been added to this section or is it empty ? */
+ bool IsEmpty() const { return this->Entries.empty(); }
+
+ /** Clear contents. */
+ void Clear() { this->Entries.clear(); }
+
+ /** Return the name of this section for the given output form. */
+ const char* GetName(cmDocumentationEnums::Form form) const
+ { return (form==cmDocumentationEnums::ManForm ?
+ this->ManName.c_str() : this->Name.c_str()); }
+
+ /** Return a pointer to the first entry of this section. */
+ const std::vector<cmDocumentationEntry> &GetEntries() const
+ { return this->Entries; }
+
+ /** Append an entry to this section. */
+ void Append(const cmDocumentationEntry& entry)
+ { this->Entries.push_back(entry); }
+ void Append(const std::vector<cmDocumentationEntry> &entries)
+ { this->Entries.insert(this->Entries.end(),entries.begin(),entries.end()); }
+
+ /** Append an entry to this section using NULL terminated chars */
+ void Append(const char *[][3]);
+ void Append(const char *n, const char *b, const char *f);
+
+ /** Set the contents of this section. */
+// void Set(const std::vector<cmDocumentationEntry> header,
+// const std::vector<cmDocumentationEntry> section,
+// const std::vector<cmDocumentationEntry> footer);
+
+private:
+ std::string Name;
+ std::string ManName;
+ std::vector<cmDocumentationEntry> Entries;
+};
+
+#endif
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
index dab2651..b59b114 100644
--- a/Source/cmDumpDocumentation.cxx
+++ b/Source/cmDumpDocumentation.cxx
@@ -23,7 +23,7 @@
#include "cmVersion.h"
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char *cmDocumentationName[][3] =
{
{0,
" DumpDocumentation - Dump documentation for CMake.", 0},
@@ -31,7 +31,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char *cmDocumentationUsage[][3] =
{
{0,
" DumpDocumentation [filename]", 0},
@@ -39,7 +39,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char *cmDocumentationDescription[][3] =
{
{0,
"The \"DumpDocumentation\" executable is only available in the build "
@@ -49,7 +49,7 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char *cmDocumentationOptions[][3] =
{
{"--all-for-coverage",
"Dump all documentation to stdout. For testing.", 0},
@@ -74,7 +74,7 @@ int DumpHTML(const char* outname)
cmOStringStream str;
str << "Documentation for Commands of CMake "
<< cmVersion::GetCMakeVersion();
- doc.AddSection(str.str().c_str(), &commands[0]);
+ doc.SetSection(str.str().c_str(), commands);
doc.Print(cmDocumentation::HTMLForm, fout);
return 0;
@@ -88,12 +88,12 @@ int DumpForCoverageToStream(std::ostream& out)
std::vector<cmDocumentationEntry> generators;
cmi.GetCommandDocumentation(commands);
cmi.GetGeneratorDocumentation(generators);
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetOptionsSection(cmDocumentationOptions);
- doc.SetCommandsSection(&commands[0]);
- doc.SetGeneratorsSection(&generators[0]);
+ 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;
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2fe4beb..16e4fb2 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -45,9 +45,9 @@ http://forums.codeblocks.org/index.php/topic,6789.0.html
void cmExtraCodeBlocksGenerator
::GetDocumentation(cmDocumentationEntry& entry, const char*) const
{
- entry.name = this->GetName();
- entry.brief = "Generates CodeBlocks project files.";
- entry.full =
+ entry.Name = this->GetName();
+ entry.Brief = "Generates CodeBlocks project files.";
+ entry.Full =
"Project files for CodeBlocks will be created in the top directory "
"and in every subdirectory which features a CMakeLists.txt file "
"containing a PROJECT() call. "
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 51f37d0..89c056e 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -45,9 +45,9 @@ cmExtraEclipseCDT4Generator
void cmExtraEclipseCDT4Generator
::GetDocumentation(cmDocumentationEntry& entry, const char*) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Eclipse CDT 4.0 project files.";
- entry.full =
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Eclipse CDT 4.0 project files.";
+ entry.Full =
"Project files for Eclipse will be created in the top directory "
"and will have a linked resource to every subdirectory which "
"features a CMakeLists.txt file containing a PROJECT() call."
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 8f66924..01be601 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -62,7 +62,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
void cmGlobalBorlandMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Borland makefiles.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Borland makefiles.";
+ entry.Full = "";
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b5323e1..463c56c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1140,9 +1140,9 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
//----------------------------------------------------------------------------
void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "";
+ entry.Full = "";
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 084d85b..e6d14b5 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -103,8 +103,8 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
void cmGlobalMSYSMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates MSYS makefiles.";
- entry.full = "The makefiles use /bin/sh as the shell. "
+ entry.Name = this->GetName();
+ entry.Brief = "Generates MSYS makefiles.";
+ entry.Full = "The makefiles use /bin/sh as the shell. "
"They require msys to be installed on the machine.";
}
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 5aeb74b..e8b86bf 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -83,8 +83,8 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
void cmGlobalMinGWMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates a make file for use with mingw32-make.";
- entry.full = "The makefiles generated use cmd.exe as the shell. "
+ entry.Name = this->GetName();
+ entry.Brief = "Generates a make file for use with mingw32-make.";
+ entry.Full = "The makefiles generated use cmd.exe as the shell. "
"They do not require msys or a unix shell.";
}
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 5ae3ebb..88dd81d 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -55,7 +55,7 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
void cmGlobalNMakeMakefileGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates NMake makefiles.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates NMake makefiles.";
+ entry.Full = "";
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 319e847..0eefef3 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -104,9 +104,9 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
void cmGlobalUnixMakefileGenerator3
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates standard UNIX makefiles.";
- entry.full =
+ entry.Name = this->GetName();
+ entry.Brief = "Generates standard UNIX makefiles.";
+ entry.Full =
"A hierarchy of UNIX makefiles is generated into the build tree. Any "
"standard UNIX-style make program can build the project through the "
"default make target. A \"make install\" target is also provided.";
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 860cbff..f7b4137 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -483,9 +483,9 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
void cmGlobalVisualStudio6Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio 6 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 6 project files.";
+ entry.Full = "";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index fe39318..345cfdf 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -446,7 +446,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout)
void cmGlobalVisualStudio71Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio .NET 2003 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio .NET 2003 project files.";
+ entry.Full = "";
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index c190c35..5136779 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -733,9 +733,9 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
void cmGlobalVisualStudio7Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio .NET 2002 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio .NET 2002 project files.";
+ entry.Full = "";
}
// make sure "special" targets have GUID's
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 9eafd92..335dd4c 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -53,9 +53,9 @@ void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout)
void cmGlobalVisualStudio8Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio .NET 2005 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio .NET 2005 project files.";
+ entry.Full = "";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx
index ced30a1..f76d745 100644
--- a/Source/cmGlobalVisualStudio8Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx
@@ -42,9 +42,9 @@ cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator()
void cmGlobalVisualStudio8Win64Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio .NET 2005 Win64 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio .NET 2005 Win64 project files.";
+ entry.Full = "";
}
void cmGlobalVisualStudio8Win64Generator
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 1a1981a..c0d31e6 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -48,9 +48,9 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
void cmGlobalVisualStudio9Generator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Visual Studio 9 2008 project files.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 9 2008 project files.";
+ entry.Full = "";
}
void cmGlobalVisualStudio9Generator
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 506c729..3335689 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -65,7 +65,7 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator()
void cmGlobalWatcomWMakeGenerator
::GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.name = this->GetName();
- entry.brief = "Generates Watcom WMake makefiles.";
- entry.full = "";
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Watcom WMake makefiles.";
+ entry.Full = "";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8d22861..f2cafa6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1215,6 +1215,17 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
{
return;
}
+
+#ifdef CMAKE_STRICT
+ if (!this->CMakeInstance->IsPropertyDefined(name,cmProperty::VARIABLE))
+ {
+ std::string msg = "Variable ";
+ msg += name;
+ msg += " set yet not defined!";
+ cmSystemTools::Error(msg.c_str());
+ }
+#endif
+
this->TemporaryDefinitionKey = name;
this->Definitions[this->TemporaryDefinitionKey] = value;
@@ -1669,6 +1680,15 @@ bool cmMakefile::IsDefinitionSet(const char* name) const
const char* cmMakefile::GetDefinition(const char* name) const
{
+#ifdef CMAKE_STRICT
+ if (!this->CMakeInstance->IsPropertyDefined(name,cmProperty::VARIABLE))
+ {
+ std::string msg = "Variable ";
+ msg += name;
+ msg += " queried yet undefined!";
+ cmSystemTools::Error(msg.c_str());
+ }
+#endif
const char* def = 0;
DefinitionMap::const_iterator pos = this->Definitions.find(name);
if(pos != this->Definitions.end())
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index 3acd184..91dad03 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -20,10 +20,9 @@
cmDocumentationEntry cmPropertyDefinition::GetDocumentation() const
{
cmDocumentationEntry e;
- e.name = this->Name.c_str();
- e.brief =
- this->ShortDescription.size() ? this->ShortDescription.c_str() : 0;
- e.full = this->FullDescription.size() ? this->FullDescription.c_str() : 0;
+ e.Name = this->Name;
+ e.Brief = this->ShortDescription;
+ e.Full = this->FullDescription;
return e;
}
@@ -31,6 +30,7 @@ void cmPropertyDefinition
::DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *shortDescription,
const char *fullDescription,
+ const char *sec,
bool chain)
{
this->Name = name;
@@ -44,5 +44,9 @@ void cmPropertyDefinition
{
this->FullDescription = fullDescription;
}
+ if (sec)
+ {
+ this->DocumentationSection = sec;
+ }
}
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index df7aa4b..a299cb3 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -26,6 +26,7 @@ public:
void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
+ const char *DocumentationSection,
bool chained);
// get the documentation string
@@ -37,10 +38,19 @@ public:
// is it chained?
bool IsChained() {return this->Chained; };
+ // Get the section if any
+ const std::string &GetDocumentationSection() const {
+ return this->DocumentationSection; };
+
+ // get the scope
+ cmProperty::ScopeType GetScope() const {
+ return this->Scope; };
+
protected:
std::string Name;
std::string ShortDescription;
std::string FullDescription;
+ std::string DocumentationSection;
cmProperty::ScopeType Scope;
bool Chained;
};
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index bfc6112..72488e1 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -16,12 +16,13 @@
=========================================================================*/
#include "cmPropertyDefinitionMap.h"
#include "cmSystemTools.h"
-
+#include "cmDocumentationSection.h"
void cmPropertyDefinitionMap
::DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
+ const char *DocumentationSection,
bool chain)
{
if (!name)
@@ -34,21 +35,59 @@ void cmPropertyDefinitionMap
if (it == this->end())
{
prop = &(*this)[name];
- prop->DefineProperty(name,scope,ShortDescription, FullDescription, chain);
+ prop->DefineProperty(name,scope,ShortDescription, FullDescription,
+ DocumentationSection, chain);
}
}
void cmPropertyDefinitionMap
-::GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v) const
+::GetPropertiesDocumentation(std::map<std::string,
+ cmDocumentationSection *>& v) const
{
for(cmPropertyDefinitionMap::const_iterator j = this->begin();
j != this->end(); ++j)
{
- cmDocumentationEntry e = j->second.GetDocumentation();
- if (e.brief)
+ // add a section if needed
+ std::string secName = j->second.GetDocumentationSection();
+ // if a section was not specified then use the scope
+ if (!secName.size())
{
- v.push_back(e);
+ switch (j->second.GetScope())
+ {
+ case cmProperty::GLOBAL:
+ secName = "Properties of Global Scope";
+ break;
+ case cmProperty::TARGET:
+ secName = "Properties on Targets";
+ break;
+ case cmProperty::SOURCE_FILE:
+ secName = "Properties on Source Files";
+ break;
+ case cmProperty::DIRECTORY:
+ secName = "Properties on Directories";
+ break;
+ case cmProperty::TEST:
+ secName = "Properties on Tests";
+ break;
+ case cmProperty::VARIABLE:
+ secName = "Variables";
+ break;
+ case cmProperty::CACHED_VARIABLE:
+ secName = "Cached Variables";
+ break;
+ default:
+ secName = "Properties of Unknown Scope";
+ break;
+ }
}
+ if (!v[secName])
+ {
+ v[secName] = new
+ cmDocumentationSection(secName.c_str(),
+ cmSystemTools::UpperCase(secName).c_str());
+ }
+ cmDocumentationEntry e = j->second.GetDocumentation();
+ v[secName]->Append(e);
}
}
diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h
index 240addf..869fe8c 100644
--- a/Source/cmPropertyDefinitionMap.h
+++ b/Source/cmPropertyDefinitionMap.h
@@ -19,6 +19,8 @@
#include "cmPropertyDefinition.h"
+class cmDocumentationSection;
+
class cmPropertyDefinitionMap :
public std::map<cmStdString,cmPropertyDefinition>
{
@@ -27,6 +29,7 @@ public:
void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
+ const char *DocumentaitonSection,
bool chain);
// has a named property been defined
@@ -35,7 +38,8 @@ public:
// is a named property set to chain
bool IsPropertyChained(const char *name);
- void GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v) const;
+ void GetPropertiesDocumentation(std::map<std::string,
+ cmDocumentationSection *>&) const;
};
#endif
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index eb77a97..4ba86ce 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -316,9 +316,16 @@ extern void operator << (std::ostream&, const cmOStringStream&);
/** Standard documentation entry for cmDocumentation's formatting. */
struct cmDocumentationEntry
{
- const char* name;
- const char* brief;
- const char* full;
+ std::string Name;
+ std::string Brief;
+ std::string Full;
+ cmDocumentationEntry(){};
+ cmDocumentationEntry(const char *doc[3])
+ { if (doc[0]) this->Name = doc[0];
+ if (doc[1]) this->Brief = doc[1];
+ if (doc[2]) this->Full = doc[2]; };
+ cmDocumentationEntry(const char *n, const char *b, const char *f)
+ { if (n) this->Name = n; if (b) this->Brief = b; if (f) this->Full = f; };
};
/** Data structure to represent a single command line. */
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 127e3da..01fcae6 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2249,31 +2249,29 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
for(RegisteredCommandsMap::const_iterator j = this->Commands.begin();
j != this->Commands.end(); ++j)
{
- if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged()))
+ if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged()))
|| ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged())))
- {
- continue;
- }
-
- cmDocumentationEntry e =
{
- (*j).second->GetName(),
- (*j).second->GetTerseDocumentation(),
- (*j).second->GetFullDocumentation()
- };
+ continue;
+ }
+
+ cmDocumentationEntry e((*j).second->GetName(),
+ (*j).second->GetTerseDocumentation(),
+ (*j).second->GetFullDocumentation());
v.push_back(e);
}
- cmDocumentationEntry empty = {0,0,0};
- v.push_back(empty);
}
-void cmake::GetPropertiesDocumentation(std::vector<cmDocumentationEntry>& v,
- cmProperty::ScopeType type)
+void cmake::GetPropertiesDocumentation(std::map<std::string,
+ cmDocumentationSection *>& v)
{
- // get the properties for cmake
- this->PropertyDefinitions[type].GetPropertiesDocumentation(v);
- cmDocumentationEntry empty = {0,0,0};
- v.push_back(empty);
+ // loop over the properties and put them into the doc structure
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::iterator i;
+ i = this->PropertyDefinitions.begin();
+ for (;i != this->PropertyDefinitions.end(); ++i)
+ {
+ i->second.GetPropertiesDocumentation(v);
+ }
}
void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
@@ -2293,12 +2291,10 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
cmDocumentationEntry e;
cmExternalMakefileProjectGenerator* generator = (i->second)();
generator->GetDocumentation(e, i->first.c_str());
- e.name = i->first.c_str();
+ e.Name = i->first;
delete generator;
v.push_back(e);
}
- cmDocumentationEntry empty = {0,0,0};
- v.push_back(empty);
}
void cmake::AddWrittenFile(const char* file)
@@ -3089,10 +3085,12 @@ void cmake::DefineProperties(cmake *cm)
void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
- bool chained)
+ bool chained, const char *docSection)
{
this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
- FullDescription, chained);
+ FullDescription,
+ docSection,
+ chained);
}
bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope)
diff --git a/Source/cmake.h b/Source/cmake.h
index c0b3cd0..c0a29b6 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -52,6 +52,7 @@ class cmCommand;
class cmVariableWatch;
class cmFileTimeComparison;
class cmExternalMakefileProjectGenerator;
+class cmDocumentationSection;
class cmake
{
@@ -250,8 +251,8 @@ class cmake
void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
bool withCurrentCommands = true,
bool withCompatCommands = true) const;
- void GetPropertiesDocumentation(std::vector<cmDocumentationEntry>&,
- cmProperty::ScopeType type);
+ void GetPropertiesDocumentation(std::map<std::string,
+ cmDocumentationSection *>&);
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
///! Set/Get a property of this target file
@@ -308,7 +309,8 @@ class cmake
void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
- bool chain = false);
+ bool chain = false,
+ const char *variableGroup = 0);
// Is a property defined?
bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 0717cf5..e7a850c 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -32,7 +32,7 @@
#ifdef CMAKE_BUILD_WITH_CMAKE
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char * cmDocumentationName[][3] =
{
{0,
" cmake - Cross-Platform Makefile Generator.", 0},
@@ -40,7 +40,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char * cmDocumentationUsage[][3] =
{
{0,
" cmake [options] <path-to-source>\n"
@@ -49,7 +49,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char * cmDocumentationDescription[][3] =
{
{0,
"The \"cmake\" executable is the CMake command-line interface. It may "
@@ -62,7 +62,7 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char * cmDocumentationOptions[][3] =
{
CMAKE_STANDARD_OPTIONS_TABLE,
{"-E", "CMake command mode.",
@@ -166,7 +166,7 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationSeeAlso[] =
+static const char * cmDocumentationSeeAlso[][3] =
{
{0, "ccmake", 0},
{0, "ctest", 0},
@@ -174,7 +174,7 @@ static const cmDocumentationEntry cmDocumentationSeeAlso[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationNOTE[] =
+static const char * cmDocumentationNOTE[][3] =
{
{0,
"CMake no longer configures a project when run with no arguments. "
@@ -300,43 +300,24 @@ int do_cmake(int ac, char** av)
std::vector<cmDocumentationEntry> commands;
std::vector<cmDocumentationEntry> compatCommands;
- std::vector<cmDocumentationEntry> globalProperties;
- std::vector<cmDocumentationEntry> dirProperties;
- std::vector<cmDocumentationEntry> targetProperties;
- std::vector<cmDocumentationEntry> testProperties;
- std::vector<cmDocumentationEntry> sourceFileProperties;
- std::vector<cmDocumentationEntry> variableProperties;
- std::vector<cmDocumentationEntry> cachedVariableProperties;
+ std::map<std::string,cmDocumentationSection *> propDocs;
std::vector<cmDocumentationEntry> generators;
hcm.GetCommandDocumentation(commands, true, false);
hcm.GetCommandDocumentation(compatCommands, false, true);
- hcm.GetPropertiesDocumentation(globalProperties, cmProperty::GLOBAL);
- hcm.GetPropertiesDocumentation(dirProperties, cmProperty::DIRECTORY);
- hcm.GetPropertiesDocumentation(targetProperties, cmProperty::TARGET);
- hcm.GetPropertiesDocumentation(testProperties, cmProperty::TEST);
- hcm.GetPropertiesDocumentation(sourceFileProperties,
- cmProperty::SOURCE_FILE);
- hcm.GetPropertiesDocumentation(variableProperties, cmProperty::VARIABLE);
- hcm.GetPropertiesDocumentation(cachedVariableProperties,
- cmProperty::CACHED_VARIABLE);
+ hcm.GetPropertiesDocumentation(propDocs);
hcm.GetGeneratorDocumentation(generators);
+
doc.SetName("cmake");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetGeneratorsSection(&generators[0]);
- doc.SetOptionsSection(cmDocumentationOptions);
- doc.SetCommandsSection(&commands[0]);
- doc.SetCompatCommandsSection(&compatCommands[0]);
- doc.SetPropertiesSection(&globalProperties[0], cmProperty::GLOBAL);
- doc.SetPropertiesSection(&dirProperties[0], cmProperty::DIRECTORY);
- doc.SetPropertiesSection(&targetProperties[0], cmProperty::TARGET);
- doc.SetPropertiesSection(&testProperties[0], cmProperty::TEST);
- doc.SetPropertiesSection(&sourceFileProperties[0],cmProperty::SOURCE_FILE);
- doc.SetPropertiesSection(&variableProperties[0],cmProperty::VARIABLE);
- doc.SetPropertiesSection(&cachedVariableProperties[0],
- cmProperty::CACHED_VARIABLE);
+ doc.SetSection("Name",cmDocumentationName);
+ doc.SetSection("Usage",cmDocumentationUsage);
+ doc.SetSection("Description",cmDocumentationDescription);
+ doc.SetSection("Generators",generators);
+ doc.SetSection("Options",cmDocumentationOptions);
+ doc.SetSection("Commands",commands);
+ doc.SetSection("Compatibility Commands",compatCommands);
+ doc.SetSections(propDocs);
+
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
int result = doc.PrintRequestedDocumentation(std::cout)? 0:1;
@@ -348,7 +329,7 @@ int do_cmake(int ac, char** av)
if((ac == 1) && cmSystemTools::FileExists("CMakeLists.txt"))
{
doc.ClearSections();
- doc.AddSection("NOTE", cmDocumentationNOTE);
+ doc.SetSection("NOTE", cmDocumentationNOTE);
doc.Print(cmDocumentation::UsageForm, std::cerr);
return 1;
}
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 5dedcc4..27971cf 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -23,7 +23,7 @@
#include "CTest/cmCTestScriptHandler.h"
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationName[] =
+static const char * cmDocumentationName[][3] =
{
{0,
" ctest - Testing driver provided by CMake.", 0},
@@ -31,7 +31,7 @@ static const cmDocumentationEntry cmDocumentationName[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationUsage[] =
+static const char * cmDocumentationUsage[][3] =
{
{0,
" ctest [options]", 0},
@@ -39,7 +39,7 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationDescription[] =
+static const char * cmDocumentationDescription[][3] =
{
{0,
"The \"ctest\" executable is the CMake test driver program. "
@@ -50,7 +50,7 @@ static const cmDocumentationEntry cmDocumentationDescription[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationOptions[] =
+static const char * cmDocumentationOptions[][3] =
{
{"-C <cfg>, --build-config <cfg>", "Choose configuration to test.",
"Some CMake-generated build trees can have multiple build configurations "
@@ -198,7 +198,7 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
};
//----------------------------------------------------------------------------
-static const cmDocumentationEntry cmDocumentationSeeAlso[] =
+static const char * cmDocumentationSeeAlso[][3] =
{
{0, "cmake", 0},
{0, "ccmake", 0},
@@ -244,11 +244,11 @@ int main (int argc, char *argv[])
ch->GetCommandDocumentation(commands);
doc.SetName("ctest");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetOptionsSection(cmDocumentationOptions);
- doc.SetCommandsSection(&commands[0]);
+ doc.SetSection("Name",cmDocumentationName);
+ doc.SetSection("Usage",cmDocumentationUsage);
+ doc.SetSection("Description",cmDocumentationDescription);
+ doc.SetSection("Options",cmDocumentationOptions);
+ doc.SetSection("Commands",commands);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
#ifdef cout
# undef cout