ENH: add dump documentation test
This commit is contained in:
parent
852be8a520
commit
a4f40c31f1
|
@ -53,6 +53,7 @@ LINK_LIBRARIES(CMakeLib)
|
||||||
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Sources)
|
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Sources)
|
||||||
|
|
||||||
ADD_EXECUTABLE(cmake cmakemain)
|
ADD_EXECUTABLE(cmake cmakemain)
|
||||||
|
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
|
||||||
|
|
||||||
ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx)
|
ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx)
|
||||||
|
|
||||||
|
@ -66,6 +67,8 @@ IF(BUILD_TESTING)
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
${CMake_SOURCE_DIR}/Source/cmaketest.h.in
|
${CMake_SOURCE_DIR}/Source/cmaketest.h.in
|
||||||
${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)
|
${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)
|
||||||
|
ADD_TEST(DumpDocumentation ${CMake_BINARY_DIR}/Source/DumpDocumentation
|
||||||
|
${CMake_BINARY_DIR}/CMakeDoc.html )
|
||||||
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
|
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
|
||||||
${CMake_SOURCE_DIR}/Tests/Simple
|
${CMake_SOURCE_DIR}/Tests/Simple
|
||||||
${CMake_BINARY_DIR}/Tests/Simple simple )
|
${CMake_BINARY_DIR}/Tests/Simple simple )
|
||||||
|
|
|
@ -3,10 +3,20 @@
|
||||||
//
|
//
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
|
||||||
int main()
|
int main(int ac, char** av)
|
||||||
{
|
{
|
||||||
cmMakefile makefile;
|
cmMakefile makefile;
|
||||||
makefile.DumpDocumentationToFile("cmake.txt");
|
const char* outname = "cmake.html";
|
||||||
|
if(ac > 1)
|
||||||
|
{
|
||||||
|
outname = av[1];
|
||||||
|
}
|
||||||
|
std::ofstream fout(outname);
|
||||||
|
if(!fout)
|
||||||
|
{
|
||||||
|
std::cerr << "failed to open output file: " << outname << "\n";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
makefile.DumpDocumentationToFile(fout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -797,16 +797,9 @@ const char* cmMakefile::GetDefinition(const char* name)
|
||||||
return cmCacheManager::GetInstance()->GetCacheValue(name);
|
return cmCacheManager::GetInstance()->GetCacheValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmMakefile::DumpDocumentationToFile(const char *fileName)
|
int cmMakefile::DumpDocumentationToFile(std::ostream& f)
|
||||||
{
|
{
|
||||||
// Open the supplied filename
|
// Open the supplied filename
|
||||||
std::ofstream f;
|
|
||||||
f.open(fileName, std::ios::out);
|
|
||||||
|
|
||||||
if ( f.fail() )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop over all registered commands and print out documentation
|
// Loop over all registered commands and print out documentation
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
|
@ -487,7 +487,7 @@ public:
|
||||||
* Dump documentation to a file. If 0 is returned, the
|
* Dump documentation to a file. If 0 is returned, the
|
||||||
* operation failed.
|
* operation failed.
|
||||||
*/
|
*/
|
||||||
int DumpDocumentationToFile(const char *fileName);
|
int DumpDocumentationToFile(std::ostream&);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand all defined varibles in the string.
|
* Expand all defined varibles in the string.
|
||||||
|
|
Loading…
Reference in New Issue