ENH: force a global generate if the cache version does not match the running cmake
This commit is contained in:
parent
4a9e790717
commit
7b54b22ccd
|
@ -279,6 +279,10 @@ bool cmCacheManager::SaveCache(const char* path)
|
||||||
"Major version of cmake used to create the "
|
"Major version of cmake used to create the "
|
||||||
"current loaded cache", cmCacheManager::INTERNAL);
|
"current loaded cache", cmCacheManager::INTERNAL);
|
||||||
|
|
||||||
|
this->AddCacheEntry("CMAKE_CACHE_RELEASE_VERSION", cmMakefile::GetReleaseVersion(),
|
||||||
|
"Major version of cmake used to create the "
|
||||||
|
"current loaded cache", cmCacheManager::INTERNAL);
|
||||||
|
|
||||||
// Let us store the current working directory so that if somebody
|
// Let us store the current working directory so that if somebody
|
||||||
// Copies it, he will not be surprised
|
// Copies it, he will not be surprised
|
||||||
std::string currentcwd = path;
|
std::string currentcwd = path;
|
||||||
|
|
|
@ -23,6 +23,22 @@
|
||||||
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
||||||
cmMakefile *mf)
|
cmMakefile *mf)
|
||||||
{
|
{
|
||||||
|
bool isLocal = m_CMakeInstance->GetLocal();
|
||||||
|
const char* majv = mf->GetDefinition("CMAKE_CACHE_MAJOR_VERSION");
|
||||||
|
const char* minv = mf->GetDefinition("CMAKE_CACHE_MINOR_VERSION");
|
||||||
|
const char* relv = mf->GetDefinition("CMAKE_CACHE_RELEASE_VERSION");
|
||||||
|
bool cacheSameCMake = false;
|
||||||
|
if(majv && atoi(majv) == cmMakefile::GetMajorVersion()
|
||||||
|
&& minv && atoi(minv) == cmMakefile::GetMinorVersion()
|
||||||
|
&& relv && (strcmp(relv, cmMakefile::GetReleaseVersion()) == 0))
|
||||||
|
{
|
||||||
|
cacheSameCMake = true;
|
||||||
|
}
|
||||||
|
if(!cacheSameCMake)
|
||||||
|
{
|
||||||
|
isLocal = false;
|
||||||
|
}
|
||||||
|
|
||||||
// if no lang specified use CXX
|
// if no lang specified use CXX
|
||||||
if(!lang )
|
if(!lang )
|
||||||
{
|
{
|
||||||
|
@ -39,7 +55,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
||||||
bool needCXXBackwards = false;
|
bool needCXXBackwards = false;
|
||||||
|
|
||||||
// check for a C compiler and configure it
|
// check for a C compiler and configure it
|
||||||
if(!m_CMakeInstance->GetLocal() &&
|
if(!isLocal &&
|
||||||
!this->GetLanguageEnabled("C") &&
|
!this->GetLanguageEnabled("C") &&
|
||||||
lang[0] == 'C')
|
lang[0] == 'C')
|
||||||
{
|
{
|
||||||
|
@ -63,7 +79,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a CXX compiler and configure it
|
// check for a CXX compiler and configure it
|
||||||
if(!m_CMakeInstance->GetLocal() &&
|
if(!isLocal &&
|
||||||
!this->GetLanguageEnabled("CXX") &&
|
!this->GetLanguageEnabled("CXX") &&
|
||||||
strcmp(lang, "CXX") == 0)
|
strcmp(lang, "CXX") == 0)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +117,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
|
||||||
mf->ReadListFile(0,fpath.c_str());
|
mf->ReadListFile(0,fpath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_CMakeInstance->GetLocal())
|
if(!isLocal)
|
||||||
{
|
{
|
||||||
// At this point we should have enough info for a try compile
|
// At this point we should have enough info for a try compile
|
||||||
// which is used in the backward stuff
|
// which is used in the backward stuff
|
||||||
|
|
Loading…
Reference in New Issue