diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 0a605f2e7..84ed6d18c 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -7,6 +7,7 @@ #undef DEBUG #include "CMakeSetup.h" #include "MakeHelp.h" +#include "cmVersion.h" #include "PathDialog.h" #include "CMakeSetupDialog.h" #include "CMakeCommandLineInfo.h" @@ -323,8 +324,9 @@ BOOL CMakeSetupDialog::OnInitDialog() // Set the version number char tmp[1024]; - sprintf(tmp,"CMake %d.%d - %s", cmake::GetMajorVersion(), - cmake::GetMinorVersion(), cmake::GetReleaseVersion()); + sprintf(tmp,"CMake %d.%d - %s", cmVersion::GetMajorVersion(), + cmVersion::GetMinorVersion(), + cmVersion::GetReleaseVersion().c_str()); SetDlgItemText(IDC_PROGRESS, ""); this->SetWindowText(tmp); this->UpdateData(FALSE); diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 3ee7c2713..f9ddd5742 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -72,9 +72,9 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args) // Get the current version number. - int current_major = this->Makefile->GetMajorVersion(); - int current_minor = this->Makefile->GetMinorVersion(); - int current_patch = this->Makefile->GetPatchVersion(); + int current_major = cmVersion::GetMajorVersion(); + int current_minor = cmVersion::GetMinorVersion(); + int current_patch = cmVersion::GetPatchVersion(); // Parse the required version number. If no patch-level is given // use zero. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 508a83a0c..f2a1cca25 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -21,6 +21,7 @@ #include "cmMakefile.h" #include "cmCPluginAPI.h" +#include "cmVersion.h" #include "cmSourceFile.h" @@ -65,12 +66,12 @@ unsigned int CCONV cmGetCacheMinorVersion(void *arg) unsigned int CCONV cmGetMajorVersion(void *) { - return cmMakefile::GetMajorVersion(); + return cmVersion::GetMajorVersion(); } unsigned int CCONV cmGetMinorVersion(void *) { - return cmMakefile::GetMinorVersion(); + return cmVersion::GetMinorVersion(); } void CCONV cmAddDefinition(void *arg, const char* name, const char* value) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 5eecb1dcc..c656a3c3c 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -20,6 +20,7 @@ #include "cmCacheManager.h" #include "cmMakefile.h" #include "cmake.h" +#include "cmVersion.h" #include #include @@ -370,17 +371,17 @@ bool cmCacheManager::SaveCache(const char* path) // before writing the cache, update the version numbers // to the char temp[1024]; - sprintf(temp, "%d", cmMakefile::GetMinorVersion()); + sprintf(temp, "%d", cmVersion::GetMinorVersion()); this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, "Minor version of cmake used to create the " "current loaded cache", cmCacheManager::INTERNAL); - sprintf(temp, "%d", cmMakefile::GetMajorVersion()); + sprintf(temp, "%d", cmVersion::GetMajorVersion()); 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", - cmMakefile::GetReleaseVersion(), + cmVersion::GetReleaseVersion().c_str(), "Major version of cmake used to create the " "current loaded cache", cmCacheManager::INTERNAL); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 476ef9229..71166a058 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -18,6 +18,7 @@ #include "cmLocalGenerator.h" #include "cmake.h" #include "cmMakefile.h" +#include "cmVersion.h" #include // required for atof @@ -270,8 +271,8 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // to avoid duplicate compiler tests. unsigned int cacheMajor = mf->GetCacheMajorVersion(); unsigned int cacheMinor = mf->GetCacheMinorVersion(); - unsigned int selfMajor = cmMakefile::GetMajorVersion(); - unsigned int selfMinor = cmMakefile::GetMinorVersion(); + unsigned int selfMajor = cmVersion::GetMajorVersion(); + unsigned int selfMinor = cmVersion::GetMinorVersion(); if((this->CMakeInstance->GetIsInTryCompile() || (selfMajor == cacheMajor && selfMinor == cacheMinor)) && !mf->GetDefinition(loadedLang.c_str())) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 84de442f0..82736d27b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1643,7 +1643,6 @@ void cmLocalGenerator { continue; } - // Link to a library if it is not the same target and is meant for // this configuration type. if((target.GetType() == cmTarget::EXECUTABLE || @@ -1664,7 +1663,6 @@ void cmLocalGenerator linkItem += "/"; linkItem += tgt->GetFullName(config); linkLibraries.push_back(linkItem); - // For full path, use the true location. if(fullPathLibs) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 059de8587..bb558eaf6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -23,6 +23,7 @@ #include "cmMakefileTargetGenerator.h" #include "cmSourceFile.h" #include "cmake.h" +#include "cmVersion.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. @@ -1728,8 +1729,8 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) << "# CMAKE generated file: DO NOT EDIT!\n" << "# Generated by \"" << this->GlobalGenerator->GetName() << "\"" << " Generator, CMake Version " - << cmMakefile::GetMajorVersion() << "." - << cmMakefile::GetMinorVersion() << "\n\n"; + << cmVersion::GetMajorVersion() << "." + << cmVersion::GetMinorVersion() << "\n\n"; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 78cc8484d..d230add23 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -15,7 +15,7 @@ =========================================================================*/ #include "cmMakefile.h" - +#include "cmVersion.h" #include "cmCommand.h" #include "cmSourceFile.h" #include "cmSystemTools.h" @@ -133,23 +133,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf) this->ListFileStack = mf.ListFileStack; } -const char* cmMakefile::GetReleaseVersion() -{ -#if CMake_VERSION_MINOR & 1 - return "development"; -#else -# if CMake_VERSION_PATCH == 1 - return "1-beta"; -# 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 -#endif -} unsigned int cmMakefile::GetCacheMajorVersion() { @@ -1965,11 +1948,11 @@ void cmMakefile::AddDefaultDefinitions() #endif char temp[1024]; - sprintf(temp, "%d", cmMakefile::GetMinorVersion()); + sprintf(temp, "%d", cmVersion::GetMinorVersion()); this->AddDefinition("CMAKE_MINOR_VERSION", temp); - sprintf(temp, "%d", cmMakefile::GetMajorVersion()); + sprintf(temp, "%d", cmVersion::GetMajorVersion()); this->AddDefinition("CMAKE_MAJOR_VERSION", temp); - sprintf(temp, "%d", cmMakefile::GetPatchVersion()); + sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddDefinition("CMAKE_PATCH_VERSION", temp); this->AddDefinition("CMAKE_FILES_DIRECTORY", diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index df3850450..943466f28 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -49,14 +49,6 @@ class cmake; class cmMakefile { 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 const char* GetReleaseVersion(); - /** * Return the major and minor version of the cmake that * was used to write the currently loaded cache, note diff --git a/Source/cmake.cxx b/Source/cmake.cxx index af6fdc9cc..910ce87b6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1487,8 +1487,8 @@ int cmake::Configure() if(!this->CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { char ver[256]; - sprintf(ver,"%i.%i",cmMakefile::GetMajorVersion(), - cmMakefile::GetMinorVersion()); + sprintf(ver,"%i.%i",cmVersion::GetMajorVersion(), + cmVersion::GetMinorVersion()); this->CacheManager->AddCacheEntry ("CMAKE_BACKWARDS_COMPATIBILITY",ver, "For backwards compatibility, what version of CMake commands and " @@ -1680,10 +1680,10 @@ bool cmake::CacheVersionMatches() this->CacheManager->GetCacheValue("CMAKE_CACHE_RELEASE_VERSION"); bool cacheSameCMake = false; if(majv && - atoi(majv) == static_cast(cmMakefile::GetMajorVersion()) + atoi(majv) == static_cast(cmVersion::GetMajorVersion()) && minv && - atoi(minv) == static_cast(cmMakefile::GetMinorVersion()) - && relv && (strcmp(relv, cmMakefile::GetReleaseVersion()) == 0)) + atoi(minv) == static_cast(cmVersion::GetMinorVersion()) + && relv && (strcmp(relv, cmVersion::GetReleaseVersion().c_str()) == 0)) { cacheSameCMake = true; } @@ -1815,21 +1815,6 @@ int cmake::Generate() return 0; } -unsigned int cmake::GetMajorVersion() -{ - return cmMakefile::GetMajorVersion(); -} - -unsigned int cmake::GetMinorVersion() -{ - return cmMakefile::GetMinorVersion(); -} - -const char *cmake::GetReleaseVersion() -{ - return cmMakefile::GetReleaseVersion(); -} - void cmake::AddCacheEntry(const char* key, const char* value, const char* helpString, int type) @@ -1852,8 +1837,9 @@ int cmake::DumpDocumentationToFile(std::ostream& f) const char *terse; const char *full; char tmp[1024]; - sprintf(tmp,"Version %d.%d (%s)", cmake::GetMajorVersion(), - cmake::GetMinorVersion(), cmVersion::GetReleaseVersion().c_str()); + sprintf(tmp,"Version %d.%d (%s)", cmVersion::GetMajorVersion(), + cmVersion::GetMinorVersion(), + cmVersion::GetReleaseVersion().c_str()); f << "\n"; f << "

Documentation for commands of CMake " << tmp << "

\n"; f << "
    \n"; @@ -1959,8 +1945,8 @@ int cmake::LoadCache() if(!this->CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) { char ver[256]; - sprintf(ver,"%i.%i",cmMakefile::GetMajorVersion(), - cmMakefile::GetMinorVersion()); + sprintf(ver,"%i.%i",cmVersion::GetMajorVersion(), + cmVersion::GetMinorVersion()); this->CacheManager->AddCacheEntry ("CMAKE_BACKWARDS_COMPATIBILITY",ver, "For backwards compatibility, what version of CMake commands and " diff --git a/Source/cmake.h b/Source/cmake.h index 1ccb5f143..39dbd2f39 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -60,13 +60,6 @@ class cmake ///! destruct an instance of cmake ~cmake(); - /** - * Return major and minor version numbers for cmake. - */ - static unsigned int GetMajorVersion(); - static unsigned int GetMinorVersion(); - static const char *GetReleaseVersion(); - ///! construct an instance of cmake static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; static const char *GetCMakeFilesDirectoryPostSlash() {