ENH: unify version stuff, get rid of it out of cmake and cmMakefile and only use cmVersion
This commit is contained in:
parent
46f8ed0648
commit
ccb77b65c6
|
@ -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);
|
||||
|
|
|
@ -72,9 +72,9 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> 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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "cmCacheManager.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmake.h"
|
||||
#include "cmVersion.h"
|
||||
|
||||
#include <cmsys/Directory.hxx>
|
||||
#include <cmsys/Glob.hxx>
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "cmLocalGenerator.h"
|
||||
#include "cmake.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmVersion.h"
|
||||
|
||||
#include <stdlib.h> // required for atof
|
||||
|
||||
|
@ -270,8 +271,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& 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()))
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<int>(cmMakefile::GetMajorVersion())
|
||||
atoi(majv) == static_cast<int>(cmVersion::GetMajorVersion())
|
||||
&& minv &&
|
||||
atoi(minv) == static_cast<int>(cmMakefile::GetMinorVersion())
|
||||
&& relv && (strcmp(relv, cmMakefile::GetReleaseVersion()) == 0))
|
||||
atoi(minv) == static_cast<int>(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 << "<html>\n";
|
||||
f << "<h1>Documentation for commands of CMake " << tmp << "</h1>\n";
|
||||
f << "<ul>\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 "
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue