summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-22 15:44:54 -0400
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-22 15:44:54 -0400
commitfc70a2bb2ae2c905c6fa9b6b8e6a0caa99ca3ee4 (patch)
tree38c00cbcf652d9319baf841a1ba3f8fd166b968d
parentf4a04a96eb57fc01b612b6af11b7e7ae66fc0cc4 (diff)
downloadcmake-fc70a2bb2ae2c905c6fa9b6b8e6a0caa99ca3ee4.tar.gz
ENH: Add development version support in CMake
-rw-r--r--Source/CMakeLists.txt4
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx4
-rw-r--r--Source/cmCTest.cxx7
-rw-r--r--Source/cmDocumentation.cxx14
-rw-r--r--Source/cmDumpDocumentation.cxx7
-rw-r--r--Source/cmVersion.cxx74
-rw-r--r--Source/cmVersion.h40
-rw-r--r--Source/cmake.cxx11
-rwxr-xr-xbootstrap1
9 files changed, 147 insertions, 15 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 3c0df7eec7..eaa2d644e9 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -22,6 +22,7 @@ cmGlobalUnixMakefileGenerator.cxx
cmLocalGenerator.cxx
cmLocalUnixMakefileGenerator.cxx
cmVariableWatch.cxx
+cmVersion.cxx
cmake.h
cmakewizard.h
cmMakeDepend.h
@@ -40,6 +41,7 @@ cmGlobalUnixMakefileGenerator.h
cmLocalGenerator.h
cmLocalUnixMakefileGenerator.h
cmVariableWatch.h
+cmVersion.h
)
@@ -118,6 +120,8 @@ ENDIF(CMAKE_BUILD_MFC_DIALOG)
ADD_EXECUTABLE(cmake cmakemain.cxx)
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
+ADD_CUSTOM_TARGET(foo ALL /bin/sh ${CMAKE_CURRENT_BINARY_DIR}/../foo.sh)
+
SET(CMTEST_SRCS ctest.cxx cmCTest.cxx
CTest/cmCTestBuildHandler.cxx
CTest/cmCTestConfigureHandler.cxx
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 11792d1f50..3972918731 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -22,6 +22,7 @@
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
+#include "cmVersion.h"
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
@@ -122,7 +123,8 @@ int cmCTestUpdateHandler::UpdateDirectory(cmCTest *ctest_inst)
}
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<BuildName>" << m_CTest->GetDartConfiguration("BuildName")
<< "</BuildName>\n"
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index eb1a74f797..f0cf6b4b2f 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -33,6 +33,7 @@
#include "cmCTestConfigureHandler.h"
#include "cmCTestSubmit.h"
+#include "cmVersion.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
@@ -1064,7 +1065,8 @@ void cmCTest::StartXML(std::ostream& ostr)
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"]
<< "\" BuildStamp=\"" << m_CurrentTag << "-"
<< this->GetTestModelString() << "\" Name=\""
- << m_DartConfiguration["Site"] << "\" Generator=\"ctest-" << CMake_VERSION_FULL
+ << m_DartConfiguration["Site"] << "\" Generator=\"ctest"
+ << cmVersion::GetCMakeVersion()
<< "\">" << 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"
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"] << "\" BuildStamp=\""
<< m_CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
- << m_DartConfiguration["Site"] << "\" Generator=\"ctest-" << CMake_VERSION_FULL
+ << m_DartConfiguration["Site"] << "\" Generator=\"ctest"
+ << cmVersion::GetCMakeVersion()
<< "\">\n"
<< "<Notes>" << std::endl;
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index dfb745e0df..3ef2c4715b 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -17,6 +17,7 @@
#include "cmDocumentation.h"
#include "cmSystemTools.h"
+#include "cmVersion.h"
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationStandardOptions[] =
@@ -127,7 +128,6 @@ cmDocumentation::cmDocumentation()
//----------------------------------------------------------------------------
bool cmDocumentation::PrintCopyright(std::ostream& os)
{
- os << "CMake version " CMake_VERSION_FULL "\n";
for(const cmDocumentationEntry* op = cmDocumentationCopyright;
op->brief; ++op)
{
@@ -150,7 +150,7 @@ bool cmDocumentation::PrintCopyright(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;
}
@@ -172,6 +172,11 @@ void cmDocumentation::ClearSections()
//----------------------------------------------------------------------------
bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
{
+ if ( ht != cmDocumentation::HTML &&
+ ht != cmDocumentation::Man )
+ {
+ this->PrintVersion(os);
+ }
switch (ht)
{
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::Man: return this->PrintDocumentationMan(os);
case cmDocumentation::Copyright: return this->PrintCopyright(os);
- case cmDocumentation::Version: return this->PrintVersion(os);
+ case cmDocumentation::Version: return true;
default: return false;
}
}
@@ -875,7 +880,8 @@ bool cmDocumentation::PrintDocumentationMan(std::ostream& os)
this->CreateManDocumentation();
os << ".TH " << this->GetNameString() << " 1 \""
<< cmSystemTools::GetCurrentDateTime("%B %d, %Y").c_str()
- << "\" \"" << this->GetNameString() << " " CMake_VERSION_FULL "\"\n";
+ << "\" \"" << this->GetNameString() << " " << cmVersion::GetCMakeVersion()
+ << "\"\n";
this->Print(ManForm, os);
return true;
}
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
index 9bfc9fc824..65447dd588 100644
--- a/Source/cmDumpDocumentation.cxx
+++ b/Source/cmDumpDocumentation.cxx
@@ -20,6 +20,7 @@
#include "cmake.h"
#include "cmDocumentation.h"
+#include "cmVersion.h"
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationName[] =
@@ -69,8 +70,10 @@ int DumpHTML(const char* outname)
cmDocumentation doc;
std::vector<cmDocumentationEntry> commands;
cmi.GetCommandDocumentation(commands);
- doc.AddSection("Documentation for Commands of CMake " CMake_VERSION_FULL,
- &commands[0]);
+ cmOStringStream str;
+ str << "Documentation for Commands of CMake "
+ << cmVersion::GetCMakeVersion();
+ doc.AddSection(str.str().c_str(), &commands[0]);
doc.Print(cmDocumentation::HTMLForm, fout);
return 0;
diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx
new file mode 100644
index 0000000000..37ae1cdfc9
--- /dev/null
+++ b/Source/cmVersion.cxx
@@ -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();
+}
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
new file mode 100644
index 0000000000..92ed9882d0
--- /dev/null
+++ b/Source/cmVersion.h
@@ -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
+
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c56c740782..d5be49623c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -22,6 +22,7 @@
#include "cmCommands.h"
#include "cmCommand.h"
#include "cmVariableWatch.h"
+#include "cmVersion.h"
// only build kdevelop generator on non-windows platforms
// when not bootstrapping cmake
@@ -175,8 +176,7 @@ void cmake::Usage(const char* program)
{
cmOStringStream errorStream;
- errorStream << "cmake version " << cmMakefile::GetMajorVersion()
- << "." << cmMakefile::GetMinorVersion() << "\n";
+ errorStream << "cmake version " << cmVersion::GetCMakeVersion() << "\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";
errorStream << "Options are:\n";
@@ -653,8 +653,7 @@ void CMakeCommandUsage(const char* program)
cmOStringStream errorStream;
errorStream
- << "cmake version " << cmMakefile::GetMajorVersion()
- << "." << cmMakefile::GetMinorVersion() << "\n";
+ << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n"
@@ -1382,8 +1381,8 @@ int cmake::DumpDocumentationToFile(std::ostream& f)
const char *terse;
const char *full;
char tmp[1024];
- sprintf(tmp,"Version %d.%d", cmake::GetMajorVersion(),
- cmake::GetMinorVersion());
+ sprintf(tmp,"Version %d.%d (%s)", cmake::GetMajorVersion(),
+ cmake::GetMinorVersion(), cmVersion::GetReleaseVersion().c_str());
f << "<html>\n";
f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n";
f << "<ul>\n";
diff --git a/bootstrap b/bootstrap
index 02778df713..e6486b5b40 100755
--- a/bootstrap
+++ b/bootstrap
@@ -52,6 +52,7 @@ CMAKE_CXX_SOURCES="\
cmCacheManager \
cmListFileCache \
cmVariableWatch \
+ cmVersion \
cmSourceGroup"
CMAKE_C_SOURCES="\