diff options
author | Brad King <brad.king@kitware.com> | 2009-03-05 20:17:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-05 20:17:07 (GMT) |
commit | 98c51ff6dcd5e6aa80050cfc00f19eb6092e79c0 (patch) | |
tree | 8aabdbd5936493a3808cf1184620ebf08ef1d8ff /Source | |
parent | 83f39ba41b2c8969db2b44761d5fed363dc170b5 (diff) | |
download | CMake-98c51ff6dcd5e6aa80050cfc00f19eb6092e79c0.zip CMake-98c51ff6dcd5e6aa80050cfc00f19eb6092e79c0.tar.gz CMake-98c51ff6dcd5e6aa80050cfc00f19eb6092e79c0.tar.bz2 |
ENH: Overhaul CMake version numbering
This moves the version numbers into an isolated configured header so
that not all of CMake needs to rebuild when the version changes.
Previously we had spaces, dashes and/or the word 'patch' randomly chosen
before the patch number. Now we always report version numbers in the
traditional format "<major>.<minor>.<patch>[-rc<rc>]".
We still use odd minor numbers for development versions. Now we also
use the CCYYMMDD date as the patch number of development versions, thus
allowing tests for exact CMake versions.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 3 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 3 | ||||
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.cpp | 4 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 2 | ||||
-rw-r--r-- | Source/WXDialog/CMakeSetupFrame.cpp | 5 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 3 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 7 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 5 | ||||
-rw-r--r-- | Source/cmDocumentVariables.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmStandardIncludes.h | 15 | ||||
-rw-r--r-- | Source/cmVersion.cxx | 26 | ||||
-rw-r--r-- | Source/cmVersion.h | 12 | ||||
-rw-r--r-- | Source/cmVersionConfig.h.in | 20 | ||||
-rw-r--r-- | Source/cmVersionMacros.h | 40 | ||||
-rw-r--r-- | Source/cmake.cxx | 4 |
17 files changed, 92 insertions, 68 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 964099c..d977a46 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -13,6 +13,10 @@ CONFIGURE_FILE( "${CMake_BINARY_DIR}/Source/cmConfigure.h" ) CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in" + "${CMake_BINARY_DIR}/Source/cmVersionConfig.h" + ) +CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in" "${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h" ) diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index ed603e8..83bf8d3 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -80,8 +80,7 @@ void cmCursesLongMessageForm::UpdateStatusBar() char version[cmCursesMainForm::MAX_WIDTH]; char vertmp[128]; - sprintf(vertmp,"CMake Version %d.%d - %s", cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(),cmVersion::GetReleaseVersion().c_str()); + sprintf(vertmp,"CMake Version %s", cmVersion::GetCMakeVersion()); int sideSpace = (width-strlen(vertmp)); for(int i=0; i<sideSpace; i++) { version[i] = ' '; } sprintf(version+sideSpace, "%s", vertmp); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index e491164..4d588a9 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -592,8 +592,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // We want to display this on the right char version[cmCursesMainForm::MAX_WIDTH]; char vertmp[128]; - sprintf(vertmp,"CMake Version %d.%d - %s", cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(),cmVersion::GetReleaseVersion().c_str()); + sprintf(vertmp,"CMake Version %s", cmVersion::GetCMakeVersion()); int sideSpace = (width-strlen(vertmp)); for(i=0; i<sideSpace; i++) { version[i] = ' '; } sprintf(version+sideSpace, "%s", vertmp); diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 68086f6..1098c97 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -330,9 +330,7 @@ BOOL CMakeSetupDialog::OnInitDialog() // Set the version number char tmp[1024]; - sprintf(tmp,"CMake %d.%d - %s", cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(), - cmVersion::GetReleaseVersion().c_str()); + sprintf(tmp,"CMake %s", cmVersion::GetCMakeVersion()); SetDlgItemText(IDC_PROGRESS, ""); this->SetWindowText(tmp); this->UpdateData(FALSE); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index e78b686..8401b32 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -144,7 +144,7 @@ int main(int argc, char** argv) CMakeSetupDialog dialog; QString title = QString("CMake %1"); - title = title.arg(cmVersion::GetCMakeVersion().c_str()); + title = title.arg(cmVersion::GetCMakeVersion()); dialog.setWindowTitle(title); dialog.show(); diff --git a/Source/WXDialog/CMakeSetupFrame.cpp b/Source/WXDialog/CMakeSetupFrame.cpp index 0e0bdca..f42ef42 100644 --- a/Source/WXDialog/CMakeSetupFrame.cpp +++ b/Source/WXDialog/CMakeSetupFrame.cpp @@ -700,9 +700,7 @@ void CMakeSetupFrm::DoInitFrame(cmCommandLineInfo &cm, const wxString &fn) m_cmGeneratorChoice->SetStringSelection(generator); wxString str; - str.Printf("CMake %d.%d - %s", cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(), - cmVersion::GetReleaseVersion().c_str()); + str.Printf("CMake %s", cmVersion::GetCMakeVersion()); str.Printf("CMakeSetup v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER); SetTitle(str); @@ -1696,7 +1694,6 @@ void CMakeSetupFrm::OnAboutClick( wxCommandEvent& event ) generators.Add(i->c_str()); wxString cmversion, cmsversion; -// cmversion.Printf("v%i.%i %s", cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion()); cmsversion.Printf("v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER); dlg->SetAboutText(cmversion, cmsversion, generators); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c1f2752..364790b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -26,6 +26,7 @@ #include "cmDynamicLoader.h" #include "cmGeneratedFileStream.h" #include "cmXMLSafe.h" +#include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestBuildHandler.h" @@ -1266,7 +1267,7 @@ void cmCTest::StartXML(std::ostream& ostr, bool append) << "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName") << "\"\n\tBuildStamp=\"" << this->CurrentTag << "-" << this->GetTestModelString() << "\"\n\tName=\"" - << this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest" + << this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-" << cmVersion::GetCMakeVersion() << "\"\n" << (append? "\tAppend=\"true\"\n":"") << "\tOSName=\"" << info.GetOSName() << "\"\n" diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index aaf863a..74e1d4d 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -410,10 +410,9 @@ bool cmCacheManager::SaveCache(const char* path) this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, "Major version of cmake used to create the " "current loaded cache", cmCacheManager::INTERNAL); - - this->AddCacheEntry("CMAKE_CACHE_RELEASE_VERSION", - cmVersion::GetReleaseVersion().c_str(), - "Major version of cmake used to create the " + sprintf(temp, "%d", cmVersion::GetPatchVersion()); + this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, + "Patch version of cmake used to create the " "current loaded cache", cmCacheManager::INTERNAL); // Let us store the current working directory so that if somebody diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index ba4a6c9..b4d89ff 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -24,9 +24,4 @@ #cmakedefine CMAKE_STRICT #define CMAKE_ROOT_DIR "${CMake_SOURCE_DIR}" #define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}" - -#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@ -#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@ -#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ -#cmakedefine CMake_VERSION_RC @CMake_VERSION_RC@ #define CMAKE_DATA_DIR "@CMAKE_DATA_DIR@" diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 27afd92..199b36a 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -110,9 +110,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables that Provide Information"); cm->DefineProperty - ("CMAKE_CACHE_RELEASE_VERSION", cmProperty::VARIABLE, - "Release version of CMake used to create the CMakeCache.txt file", - "This is stores the release version of CMake used to " + ("CMAKE_CACHE_PATCH_VERSION", cmProperty::VARIABLE, + "Patch version of CMake used to create the CMakeCache.txt file", + "This is stores the patch 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.", false, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 246731f..e9c44a5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -26,6 +26,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmTest.h" +#include "cmVersion.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 390cb16..30d1a7f 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -21,26 +21,11 @@ #ifndef cmStandardIncludes_h #define cmStandardIncludes_h -#define CMAKE_TO_STRING(x) CMAKE_TO_STRING0(x) -#define CMAKE_TO_STRING0(x) #x - // include configure generated header to define CMAKE_NO_ANSI_STREAM_HEADERS, // CMAKE_NO_STD_NAMESPACE, and other macros. #include "cmConfigure.h" #include <cmsys/Configure.hxx> -#define CMake_VERSION \ - CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_MINOR) - -#define CMake_VERSION_FULL \ - CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_MINOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_PATCH) - -#define CMake_VERSION_ENCODE(major, minor, patch) \ - ((major)*0x10000u + (minor)*0x100u + (patch)) - #ifdef _MSC_VER #pragma warning ( disable : 4786 ) #pragma warning ( disable : 4503 ) diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx index 77b19aa..0518c1f 100644 --- a/Source/cmVersion.cxx +++ b/Source/cmVersion.cxx @@ -16,27 +16,13 @@ =========================================================================*/ #include "cmVersion.h" -#include <cmsys/DateStamp.h> +#include "cmVersionMacros.h" -std::string cmVersion::GetReleaseVersion() -{ -#if CMake_VERSION_MINOR & 1 - return cmsys_DATE_STAMP_STRING_FULL; -#else -# ifdef CMake_VERSION_RC - return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH) " RC-" - CMAKE_TO_STRING(CMake_VERSION_RC); -# else - return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH); -# endif -#endif -} +unsigned int cmVersion::GetMajorVersion() { return CMake_VERSION_MAJOR; } +unsigned int cmVersion::GetMinorVersion() { return CMake_VERSION_MINOR; } +unsigned int cmVersion::GetPatchVersion() { return CMake_VERSION_PATCH; } -std::string cmVersion::GetCMakeVersion() +const char* cmVersion::GetCMakeVersion() { - cmOStringStream str; - str << CMake_VERSION_MAJOR << "." << CMake_VERSION_MINOR - << "-" - << cmVersion::GetReleaseVersion(); - return str.str(); + return CMake_VERSION_FULL CMake_VERSION_RC_SUFFIX; } diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 29eb9d1..de92b4e 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -30,12 +30,14 @@ 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 unsigned int GetPatchVersion() { return CMake_VERSION_PATCH; } - static std::string GetReleaseVersion(); - static std::string GetCMakeVersion(); + static unsigned int GetMajorVersion(); + static unsigned int GetMinorVersion(); + static unsigned int GetPatchVersion(); + static const char* GetCMakeVersion(); }; +#define CMake_VERSION_ENCODE(major, minor, patch) \ + ((major)*0x10000u + (minor)*0x100u + (patch)) + #endif diff --git a/Source/cmVersionConfig.h.in b/Source/cmVersionConfig.h.in new file mode 100644 index 0000000..eced4d4 --- /dev/null +++ b/Source/cmVersionConfig.h.in @@ -0,0 +1,20 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@ +#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@ +#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ +#cmakedefine CMake_VERSION_RC @CMake_VERSION_RC@ diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h new file mode 100644 index 0000000..aaaa4e3 --- /dev/null +++ b/Source/cmVersionMacros.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 cmVersionMacros_h +#define cmVersionMacros_h + +#include "cmVersionConfig.h" + +#define CMAKE_TO_STRING(x) CMAKE_TO_STRING0(x) +#define CMAKE_TO_STRING0(x) #x + +#define CMake_VERSION \ + CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ + CMAKE_TO_STRING(CMake_VERSION_MINOR) + +#define CMake_VERSION_FULL \ + CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ + CMAKE_TO_STRING(CMake_VERSION_MINOR) "." \ + CMAKE_TO_STRING(CMake_VERSION_PATCH) + +#if !(CMake_VERSION_MINOR & 1) && defined(CMake_VERSION_RC) +# define CMake_VERSION_RC_SUFFIX "-rc" CMAKE_TO_STRING(CMake_VERSION_RC) +#else +# define CMake_VERSION_RC_SUFFIX "" +#endif + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index da69073..4068259 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2355,9 +2355,7 @@ int cmake::DumpDocumentationToFile(std::ostream& f) const char *terse; const char *full; char tmp[1024]; - sprintf(tmp,"Version %d.%d (%s)", cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(), - cmVersion::GetReleaseVersion().c_str()); + sprintf(tmp,"Version %s", cmVersion::GetCMakeVersion()); f << "<html>\n"; f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n"; f << "<ul>\n"; |