Index: Source/cmBootstrapCommands.cxx =================================================================== --- Source/cmBootstrapCommands.cxx (revision 3713) +++ Source/cmBootstrapCommands.cxx (working copy) @@ -23,6 +23,7 @@ #include "cmAddCustomTargetCommand.cxx" #include "cmAddDefinitionsCommand.cxx" #include "cmAddDependenciesCommand.cxx" +#include "cmAddDocumentationCommand.cxx" #include "cmAddExecutableCommand.cxx" #include "cmAddLibraryCommand.cxx" #include "cmAddTestCommand.cxx" @@ -73,6 +74,7 @@ commands.push_back(new cmAddCustomTargetCommand); commands.push_back(new cmAddDefinitionsCommand); commands.push_back(new cmAddDependenciesCommand); + commands.push_back(new cmAddDocumentationCommand); commands.push_back(new cmAddExecutableCommand); commands.push_back(new cmAddLibraryCommand); commands.push_back(new cmAddTestCommand); Index: Source/cmAddDocumentationCommand.h =================================================================== --- Source/cmAddDocumentationCommand.h (revision 0) +++ Source/cmAddDocumentationCommand.h (revision 0) @@ -0,0 +1,68 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: cmAddDocumentationCommand.h + Language: C++ + Date: 2007/12/06 + + Based upon cmAddLibraryCommand.h + Written by Josef Karthauser, Geomerics Ltd + +=========================================================================*/ +#ifndef cmDocumentationCommand_h +#define cmDocumentationCommand_h + +#include "cmCommand.h" + +/** \class cmDocumentationCommand + * \brief Defines a list of doc files. + * + * cmDocumentationCommand defines a list of documentation with which are + * associated with a project. + */ +class cmAddDocumentationCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmAddDocumentationCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "ADD_DOCUMENTATION";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Add documentation to the project using the specified source files."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " ADD_DOCUMENTATION(file1 file2 ... fileN)\n" + "Adds the specified documentation files to the project. " + "This does nothing other than cause them to be added to a Visual Studio project."; + } + + cmTypeMacro(cmAddDocumentationCommand, cmCommand); +}; + + +#endif Index: Source/cmMakefile.cxx =================================================================== --- Source/cmMakefile.cxx (revision 3713) +++ Source/cmMakefile.cxx (working copy) @@ -1367,6 +1367,22 @@ this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it); } + +void cmMakefile::AddDocumentation(const char* targetName, const std::vector &docs) +{ + cmTarget target; + target.SetType(cmTarget::UTILITY, targetName); + + target.SetInAll(0); + target.GetSourceLists() = docs; + target.SetMakefile(this); + this->AddGlobalLinkInformation(targetName, target); + cmTargets::iterator it = + this->Targets.insert(cmTargets::value_type(targetName,target)).first; + this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it); +} + + cmTarget* cmMakefile::AddExecutable(const char *exeName, const std::vector &srcs, bool in_all) Index: Source/cmAddDocumentationCommand.cxx =================================================================== --- Source/cmAddDocumentationCommand.cxx (revision 0) +++ Source/cmAddDocumentationCommand.cxx (revision 0) @@ -0,0 +1,41 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: cmAddDocumentationCommand.cxx + Language: C++ + Date: 2007/12/06 + + Based upon cmAddLibraryCommand.cxx. + Written by Josef Karthauser, Geomerics Ltd + +=========================================================================*/ +#include "cmAddDocumentationCommand.h" + +// cmDocumentationCommand +bool cmAddDocumentationCommand::InitialPass(std::vector const& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + std::vector::const_iterator s = args.begin(); + + std::string targetName = *s; + + ++s; + + std::vector doclists; + while (s != args.end()) + { + doclists.push_back(*s); + ++s; + } + + this->Makefile->AddDocumentation(targetName.c_str(), doclists); + + return true; +} + + Index: Source/cmMakefile.h =================================================================== --- Source/cmMakefile.h (revision 3713) +++ Source/cmMakefile.h (working copy) @@ -289,7 +289,12 @@ void AddLibrary(const char *libname, int shared, const std::vector &srcs, bool in_all = true); - + + /** + * Set associated documentation. + */ + void AddDocumentation(const char *targetName, const std::vector &docs); + #if defined(CMAKE_BUILD_WITH_CMAKE) /** * Add a source group for consideration when adding a new source.