diff options
-rw-r--r-- | CMakeCPack.cmake | 13 | ||||
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-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 | ||||
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/VersionTest.cmake.in | 9 | ||||
-rwxr-xr-x | bootstrap | 46 |
22 files changed, 127 insertions, 112 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index ec4cb99..51715cc 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -18,18 +18,13 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}") -# if version date is set then use that as the patch - IF(CMake_VERSION_DATE) - SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_DATE}") - ELSE(CMake_VERSION_DATE) - SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") - ENDIF(CMake_VERSION_DATE) + SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME - "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") IF(CMake_VERSION_RC) SET(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CPACK_SOURCE_PACKAGE_FILE_NAME}-RC-${CMake_VERSION_RC}") + "${CPACK_SOURCE_PACKAGE_FILE_NAME}-rc${CMake_VERSION_RC}") ENDIF(CMake_VERSION_RC) IF(NOT DEFINED CPACK_SYSTEM_NAME) # make sure package is not Cygwin-unknown, for Cygwin just @@ -82,7 +77,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CPACK_PACKAGE_NAME cmake) # setup the name of the package for cygwin cmake-2.4.3 SET(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") # the source has the same name as the binary SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) # Create a cygwin version number in case there are changes for cygwin diff --git a/CMakeLists.txt b/CMakeLists.txt index 03a0e58..d48bda2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,11 +361,11 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 7) SET(CMake_VERSION_PATCH 0) -# CVS versions are odd, if this is an odd minor version -# then set the CMake_VERSION_DATE variable +# We use odd minor numbers for development versions. +# Use a date for the development patch level. IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake) - SET(CMake_VERSION_DATE + SET(CMake_VERSION_PATCH "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}" ) ENDIF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") @@ -425,10 +425,6 @@ IF(BUILD_QtDialog) IF(APPLE) SET(CMAKE_BUNDLE_NAME "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}") - IF(CMake_VERSION_DATE) - SET(CMAKE_BUNDLE_NAME - "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_DATE}") - ENDIF(CMake_VERSION_DATE) SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") # make sure CMAKE_INSTALL_PREFIX ends in / STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) 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"; diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 9e3c3e7..e8ed3a3 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -15,6 +15,7 @@ AddCMakeTest(Include "") AddCMakeTest(FindBase "") AddCMakeTest(Toolchain "") AddCMakeTest(GetFilenameComponentRealpath "") +AddCMakeTest(Version "") SET(GetPrerequisites_PreArgs "-DCTEST_CONFIGURATION_TYPE:STRING=\\\${CTEST_CONFIGURATION_TYPE}" diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in new file mode 100644 index 0000000..215bb2b --- /dev/null +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -0,0 +1,9 @@ +set(min_ver 2.7.20090305) +cmake_minimum_required(VERSION ${min_ver}) + +if("${CMAKE_VERSION}" VERSION_LESS "${min_ver}") + message(FATAL_ERROR + "CMAKE_VERSION=[${CMAKE_VERSION}] is less than [${min_ver}]") +else() + message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") +endif() @@ -40,10 +40,13 @@ cmake_binary_dir=`pwd` cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk" cmake_version_major="`cmake_version_component MAJOR`" cmake_version_minor="`cmake_version_component MINOR`" -cmake_version_patch="`cmake_version_component PATCH`" +if echo "${cmake_version_minor}" | grep "[0-9]*[13579]" > /dev/null 2>&1; then + cmake_version_patch="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`" +else + cmake_version_patch="`cmake_version_component PATCH`" +fi cmake_version="${cmake_version_major}.${cmake_version_minor}" cmake_version_full="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" -cmake_date_stamp="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`" cmake_data_dir="/share/cmake-${cmake_version}" cmake_doc_dir="/doc/cmake-${cmake_version}" cmake_man_dir="/man" @@ -283,15 +286,7 @@ EOF # Display CMake bootstrap usage cmake_version_display() { - ( - # Get CMake version - if echo "${cmake_version_full}" | grep "[0-9]\.[0-9]*[13579]\.[0-9]" > /dev/null 2>&1; then - version="${cmake_version}-${cmake_date_stamp}" - else - version="${cmake_version}-${cmake_version_patch}" - fi - echo "CMake ${version}, Copyright (c) 2007 Kitware, Inc., Insight Consortium" - ) + echo "CMake ${cmake_version_full}, Copyright (c) 2000-2009 Kitware, Inc., Insight Consortium" } # Display CMake bootstrap error, display the log file and exit @@ -594,6 +589,7 @@ done # Delete all the bootstrap files rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h.tmp" +rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h.tmp" # If exist compiler flags, set them cmake_c_flags=${CFLAGS} @@ -1204,19 +1200,21 @@ else fi # Write CMake version -cmake_report cmConfigure.h.tmp "#define CMake_VERSION_MAJOR ${cmake_version_major}" -cmake_report cmConfigure.h.tmp "#define CMake_VERSION_MINOR ${cmake_version_minor}" -cmake_report cmConfigure.h.tmp "#define CMake_VERSION_PATCH ${cmake_version_patch}" +cmake_report cmVersionConfig.h.tmp "#define CMake_VERSION_MAJOR ${cmake_version_major}" +cmake_report cmVersionConfig.h.tmp "#define CMake_VERSION_MINOR ${cmake_version_minor}" +cmake_report cmVersionConfig.h.tmp "#define CMake_VERSION_PATCH ${cmake_version_patch}" cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\"" cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\"" cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP" -# Regenerate real cmConfigure.h -if diff cmConfigure.h cmConfigure.h.tmp > /dev/null 2> /dev/null; then - rm -f cmConfigure.h.tmp -else - mv -f cmConfigure.h.tmp cmConfigure.h -fi +# Regenerate configured headers +for h in Configure VersionConfig; do + if diff cm${h}.h cm${h}.h.tmp > /dev/null 2> /dev/null; then + rm -f cm${h}.h.tmp + else + mv -f cm${h}.h.tmp cm${h}.h + fi +done # Prepare KWSYS cmake_kwsys_config_replace_string \ @@ -1228,14 +1226,6 @@ cmake_kwsys_config_replace_string \ "${cmake_bootstrap_dir}/cmsys/Configure.h" \ "${cmake_compiler_settings_comment}" -cat>"${cmake_bootstrap_dir}/cmsys/DateStamp.h"<<EOF -/* Minimal DateStamp header for CMake bootstrap build. */ -#ifndef cmsys_DateStamp_h -#define cmsys_DateStamp_h -#define cmsys_DATE_STAMP_STRING_FULL "${cmake_date_stamp}" -#endif -EOF - for a in ${KWSYS_FILES}; do cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \ "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys |