mirror of
https://github.com/reactos/CMake.git
synced 2025-02-07 12:26:40 +00:00
ENH: Add development version support in CMake
This commit is contained in:
parent
f4a04a96eb
commit
fc70a2bb2a
@ -22,6 +22,7 @@ cmGlobalUnixMakefileGenerator.cxx
|
|||||||
cmLocalGenerator.cxx
|
cmLocalGenerator.cxx
|
||||||
cmLocalUnixMakefileGenerator.cxx
|
cmLocalUnixMakefileGenerator.cxx
|
||||||
cmVariableWatch.cxx
|
cmVariableWatch.cxx
|
||||||
|
cmVersion.cxx
|
||||||
cmake.h
|
cmake.h
|
||||||
cmakewizard.h
|
cmakewizard.h
|
||||||
cmMakeDepend.h
|
cmMakeDepend.h
|
||||||
@ -40,6 +41,7 @@ cmGlobalUnixMakefileGenerator.h
|
|||||||
cmLocalGenerator.h
|
cmLocalGenerator.h
|
||||||
cmLocalUnixMakefileGenerator.h
|
cmLocalUnixMakefileGenerator.h
|
||||||
cmVariableWatch.h
|
cmVariableWatch.h
|
||||||
|
cmVersion.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +120,8 @@ ENDIF(CMAKE_BUILD_MFC_DIALOG)
|
|||||||
ADD_EXECUTABLE(cmake cmakemain.cxx)
|
ADD_EXECUTABLE(cmake cmakemain.cxx)
|
||||||
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
|
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
|
||||||
|
|
||||||
|
ADD_CUSTOM_TARGET(foo ALL /bin/sh ${CMAKE_CURRENT_BINARY_DIR}/../foo.sh)
|
||||||
|
|
||||||
SET(CMTEST_SRCS ctest.cxx cmCTest.cxx
|
SET(CMTEST_SRCS ctest.cxx cmCTest.cxx
|
||||||
CTest/cmCTestBuildHandler.cxx
|
CTest/cmCTestBuildHandler.cxx
|
||||||
CTest/cmCTestConfigureHandler.cxx
|
CTest/cmCTestConfigureHandler.cxx
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
|
#include "cmVersion.h"
|
||||||
|
|
||||||
//#include <cmsys/RegularExpression.hxx>
|
//#include <cmsys/RegularExpression.hxx>
|
||||||
#include <cmsys/Process.h>
|
#include <cmsys/Process.h>
|
||||||
@ -122,7 +123,8 @@ int cmCTestUpdateHandler::UpdateDirectory(cmCTest *ctest_inst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
<< "<Update mode=\"Client\" Generator=\"ctest-" << CMake_VERSION_FULL << "\">\n"
|
<< "<Update mode=\"Client\" Generator=\"ctest-"
|
||||||
|
<< cmVersion::GetCMakeVersion() << "\">\n"
|
||||||
<< "\t<Site>" << m_CTest->GetDartConfiguration("Site") << "</Site>\n"
|
<< "\t<Site>" << m_CTest->GetDartConfiguration("Site") << "</Site>\n"
|
||||||
<< "\t<BuildName>" << m_CTest->GetDartConfiguration("BuildName")
|
<< "\t<BuildName>" << m_CTest->GetDartConfiguration("BuildName")
|
||||||
<< "</BuildName>\n"
|
<< "</BuildName>\n"
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "cmCTestConfigureHandler.h"
|
#include "cmCTestConfigureHandler.h"
|
||||||
|
|
||||||
#include "cmCTestSubmit.h"
|
#include "cmCTestSubmit.h"
|
||||||
|
#include "cmVersion.h"
|
||||||
|
|
||||||
#include <cmsys/RegularExpression.hxx>
|
#include <cmsys/RegularExpression.hxx>
|
||||||
#include <cmsys/Process.h>
|
#include <cmsys/Process.h>
|
||||||
@ -1064,7 +1065,8 @@ void cmCTest::StartXML(std::ostream& ostr)
|
|||||||
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"]
|
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"]
|
||||||
<< "\" BuildStamp=\"" << m_CurrentTag << "-"
|
<< "\" BuildStamp=\"" << m_CurrentTag << "-"
|
||||||
<< this->GetTestModelString() << "\" Name=\""
|
<< this->GetTestModelString() << "\" Name=\""
|
||||||
<< m_DartConfiguration["Site"] << "\" Generator=\"ctest-" << CMake_VERSION_FULL
|
<< m_DartConfiguration["Site"] << "\" Generator=\"ctest"
|
||||||
|
<< cmVersion::GetCMakeVersion()
|
||||||
<< "\">" << std::endl;
|
<< "\">" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,7 +1082,8 @@ int cmCTest::GenerateDartNotesOutput(std::ostream& os, const cmCTest::tm_VectorO
|
|||||||
<< "<?xml-stylesheet type=\"text/xsl\" href=\"Dart/Source/Server/XSL/Build.xsl <file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
|
<< "<?xml-stylesheet type=\"text/xsl\" href=\"Dart/Source/Server/XSL/Build.xsl <file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
|
||||||
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"] << "\" BuildStamp=\""
|
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"] << "\" BuildStamp=\""
|
||||||
<< m_CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
|
<< m_CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
|
||||||
<< m_DartConfiguration["Site"] << "\" Generator=\"ctest-" << CMake_VERSION_FULL
|
<< m_DartConfiguration["Site"] << "\" Generator=\"ctest"
|
||||||
|
<< cmVersion::GetCMakeVersion()
|
||||||
<< "\">\n"
|
<< "\">\n"
|
||||||
<< "<Notes>" << std::endl;
|
<< "<Notes>" << std::endl;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "cmDocumentation.h"
|
#include "cmDocumentation.h"
|
||||||
|
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
#include "cmVersion.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static const cmDocumentationEntry cmDocumentationStandardOptions[] =
|
static const cmDocumentationEntry cmDocumentationStandardOptions[] =
|
||||||
@ -127,7 +128,6 @@ cmDocumentation::cmDocumentation()
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmDocumentation::PrintCopyright(std::ostream& os)
|
bool cmDocumentation::PrintCopyright(std::ostream& os)
|
||||||
{
|
{
|
||||||
os << "CMake version " CMake_VERSION_FULL "\n";
|
|
||||||
for(const cmDocumentationEntry* op = cmDocumentationCopyright;
|
for(const cmDocumentationEntry* op = cmDocumentationCopyright;
|
||||||
op->brief; ++op)
|
op->brief; ++op)
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ bool cmDocumentation::PrintCopyright(std::ostream& os)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmDocumentation::PrintVersion(std::ostream& os)
|
bool cmDocumentation::PrintVersion(std::ostream& os)
|
||||||
{
|
{
|
||||||
os << this->GetNameString() << " version " CMake_VERSION_FULL "\n";
|
os << this->GetNameString() << " version " << cmVersion::GetCMakeVersion() << "\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +172,11 @@ void cmDocumentation::ClearSections()
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
|
bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
|
||||||
{
|
{
|
||||||
|
if ( ht != cmDocumentation::HTML &&
|
||||||
|
ht != cmDocumentation::Man )
|
||||||
|
{
|
||||||
|
this->PrintVersion(os);
|
||||||
|
}
|
||||||
switch (ht)
|
switch (ht)
|
||||||
{
|
{
|
||||||
case cmDocumentation::Usage: return this->PrintDocumentationUsage(os);
|
case cmDocumentation::Usage: return this->PrintDocumentationUsage(os);
|
||||||
@ -181,7 +186,7 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
|
|||||||
case cmDocumentation::HTML: return this->PrintDocumentationHTML(os);
|
case cmDocumentation::HTML: return this->PrintDocumentationHTML(os);
|
||||||
case cmDocumentation::Man: return this->PrintDocumentationMan(os);
|
case cmDocumentation::Man: return this->PrintDocumentationMan(os);
|
||||||
case cmDocumentation::Copyright: return this->PrintCopyright(os);
|
case cmDocumentation::Copyright: return this->PrintCopyright(os);
|
||||||
case cmDocumentation::Version: return this->PrintVersion(os);
|
case cmDocumentation::Version: return true;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,7 +880,8 @@ bool cmDocumentation::PrintDocumentationMan(std::ostream& os)
|
|||||||
this->CreateManDocumentation();
|
this->CreateManDocumentation();
|
||||||
os << ".TH " << this->GetNameString() << " 1 \""
|
os << ".TH " << this->GetNameString() << " 1 \""
|
||||||
<< cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str()
|
<< cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str()
|
||||||
<< "\" \"" << this->GetNameString() << " " CMake_VERSION_FULL "\"\n";
|
<< "\" \"" << this->GetNameString() << " " << cmVersion::GetCMakeVersion()
|
||||||
|
<< "\"\n";
|
||||||
this->Print(ManForm, os);
|
this->Print(ManForm, os);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
#include "cmDocumentation.h"
|
#include "cmDocumentation.h"
|
||||||
|
#include "cmVersion.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static const cmDocumentationEntry cmDocumentationName[] =
|
static const cmDocumentationEntry cmDocumentationName[] =
|
||||||
@ -69,8 +70,10 @@ int DumpHTML(const char* outname)
|
|||||||
cmDocumentation doc;
|
cmDocumentation doc;
|
||||||
std::vector<cmDocumentationEntry> commands;
|
std::vector<cmDocumentationEntry> commands;
|
||||||
cmi.GetCommandDocumentation(commands);
|
cmi.GetCommandDocumentation(commands);
|
||||||
doc.AddSection("Documentation for Commands of CMake " CMake_VERSION_FULL,
|
cmOStringStream str;
|
||||||
&commands[0]);
|
str << "Documentation for Commands of CMake "
|
||||||
|
<< cmVersion::GetCMakeVersion();
|
||||||
|
doc.AddSection(str.str().c_str(), &commands[0]);
|
||||||
doc.Print(cmDocumentation::HTMLForm, fout);
|
doc.Print(cmDocumentation::HTMLForm, fout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
74
Source/cmVersion.cxx
Normal file
74
Source/cmVersion.cxx
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
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 "cmVersion.h"
|
||||||
|
|
||||||
|
std::string cmVersion::GetReleaseVersion()
|
||||||
|
{
|
||||||
|
#if CMake_VERSION_MINOR & 1
|
||||||
|
std::string cver = "Date: 2004-10-22 19:44:54 +0000";
|
||||||
|
std::string res = "";
|
||||||
|
std::string::size_type cc, len = cver.size();
|
||||||
|
bool aftercol = false;
|
||||||
|
int cnt = 0;
|
||||||
|
for ( cc = 0; cc < len; cc ++ )
|
||||||
|
{
|
||||||
|
if ( aftercol )
|
||||||
|
{
|
||||||
|
char ch = cver[cc];
|
||||||
|
switch ( ch )
|
||||||
|
{
|
||||||
|
case ' ':
|
||||||
|
case ':':
|
||||||
|
case '/':
|
||||||
|
case '-':
|
||||||
|
case '$':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res += ch;
|
||||||
|
cnt ++;
|
||||||
|
}
|
||||||
|
if ( cnt >= 8 )
|
||||||
|
{
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( cver[cc] == ':' )
|
||||||
|
{
|
||||||
|
aftercol = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
#else
|
||||||
|
# if CMake_VERSION_PATCH == 0
|
||||||
|
return "beta";
|
||||||
|
# else
|
||||||
|
return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cmVersion::GetCMakeVersion()
|
||||||
|
{
|
||||||
|
cmOStringStream str;
|
||||||
|
str << CMake_VERSION_MAJOR << "." << CMake_VERSION_MINOR
|
||||||
|
<< "-"
|
||||||
|
<< cmVersion::GetReleaseVersion();
|
||||||
|
return str.str();
|
||||||
|
}
|
40
Source/cmVersion.h
Normal file
40
Source/cmVersion.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
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 cmVersion_h
|
||||||
|
#define cmVersion_h
|
||||||
|
|
||||||
|
#include "cmStandardIncludes.h"
|
||||||
|
|
||||||
|
/** \class cmVersion
|
||||||
|
* \brief Helper class for providing CMake and CTest version information.
|
||||||
|
*
|
||||||
|
* Finds all version related information.
|
||||||
|
*/
|
||||||
|
class cmVersion
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Return major and minor version numbers for cmake.
|
||||||
|
*/
|
||||||
|
static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
|
||||||
|
static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
|
||||||
|
static std::string GetReleaseVersion();
|
||||||
|
static std::string GetCMakeVersion();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -22,6 +22,7 @@
|
|||||||
#include "cmCommands.h"
|
#include "cmCommands.h"
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
#include "cmVariableWatch.h"
|
#include "cmVariableWatch.h"
|
||||||
|
#include "cmVersion.h"
|
||||||
|
|
||||||
// only build kdevelop generator on non-windows platforms
|
// only build kdevelop generator on non-windows platforms
|
||||||
// when not bootstrapping cmake
|
// when not bootstrapping cmake
|
||||||
@ -175,8 +176,7 @@ void cmake::Usage(const char* program)
|
|||||||
{
|
{
|
||||||
cmOStringStream errorStream;
|
cmOStringStream errorStream;
|
||||||
|
|
||||||
errorStream << "cmake version " << cmMakefile::GetMajorVersion()
|
errorStream << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
|
||||||
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
|
||||||
errorStream << "Usage: " << program << " [srcdir] [options]\n"
|
errorStream << "Usage: " << program << " [srcdir] [options]\n"
|
||||||
<< "Where cmake is run from the directory where you want the object files written. If srcdir is not specified, the current directory is used for both source and object files.\n";
|
<< "Where cmake is run from the directory where you want the object files written. If srcdir is not specified, the current directory is used for both source and object files.\n";
|
||||||
errorStream << "Options are:\n";
|
errorStream << "Options are:\n";
|
||||||
@ -653,8 +653,7 @@ void CMakeCommandUsage(const char* program)
|
|||||||
cmOStringStream errorStream;
|
cmOStringStream errorStream;
|
||||||
|
|
||||||
errorStream
|
errorStream
|
||||||
<< "cmake version " << cmMakefile::GetMajorVersion()
|
<< "cmake version " << cmVersion::GetCMakeVersion() << "\n";
|
||||||
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
|
||||||
|
|
||||||
errorStream
|
errorStream
|
||||||
<< "Usage: " << program << " -E [command] [arguments ...]\n"
|
<< "Usage: " << program << " -E [command] [arguments ...]\n"
|
||||||
@ -1382,8 +1381,8 @@ int cmake::DumpDocumentationToFile(std::ostream& f)
|
|||||||
const char *terse;
|
const char *terse;
|
||||||
const char *full;
|
const char *full;
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
sprintf(tmp,"Version %d.%d", cmake::GetMajorVersion(),
|
sprintf(tmp,"Version %d.%d (%s)", cmake::GetMajorVersion(),
|
||||||
cmake::GetMinorVersion());
|
cmake::GetMinorVersion(), cmVersion::GetReleaseVersion().c_str());
|
||||||
f << "<html>\n";
|
f << "<html>\n";
|
||||||
f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n";
|
f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n";
|
||||||
f << "<ul>\n";
|
f << "<ul>\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user