[Cmake-commits] [cmake-commits] martink committed cmCMakeMinimumRequired.cxx 1.16 1.17 cmCacheManager.h 1.48 1.49 cmListFileCache.cxx 1.36 1.37 cmPolicies.cxx 1.13 1.14 cmake.cxx 1.364 1.365
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Mar 7 11:43:49 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26335
Modified Files:
cmCMakeMinimumRequired.cxx cmCacheManager.h
cmListFileCache.cxx cmPolicies.cxx cmake.cxx
Log Message:
ENH: clean up some policy stuff and interactions with CMAKE_BACKWARDS_COMPATIBILITY and CMAKE_MINIMUM_REQUIRED
Index: cmCacheManager.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCacheManager.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -C 2 -d -r1.48 -r1.49
*** cmCacheManager.h 29 Jan 2008 22:30:48 -0000 1.48
--- cmCacheManager.h 7 Mar 2008 16:43:47 -0000 1.49
***************
*** 67,70 ****
--- 67,71 ----
void SetValue(const char*);
CacheEntryType GetType() const { return this->GetEntry().Type; }
+ void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; }
bool Initialized() { return this->GetEntry().Initialized; }
cmCacheManager &Container;
Index: cmListFileCache.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmListFileCache.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -C 2 -d -r1.36 -r1.37
*** cmListFileCache.cxx 7 Mar 2008 14:41:14 -0000 1.36
--- cmListFileCache.cxx 7 Mar 2008 16:43:47 -0000 1.37
***************
*** 135,154 ****
break;
}
}
// if no policy command is found this is an error
if(!hasPolicy)
{
- // add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility
- if (!mf->GetCacheManager()->
- GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
- {
- mf->AddCacheDefinition
- ("CMAKE_BACKWARDS_COMPATIBILITY", "2.5",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmCacheManager::STRING);
- }
-
switch (mf->GetPolicyStatus(cmPolicies::CMP_0000))
{
--- 135,147 ----
break;
}
+ if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required")
+ {
+ hasPolicy = true;
+ break;
+ }
}
// if no policy command is found this is an error
if(!hasPolicy)
{
switch (mf->GetPolicyStatus(cmPolicies::CMP_0000))
{
***************
*** 166,183 ****
}
}
- else
- {
- // add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility
- if (!mf->GetCacheManager()->
- GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
- {
- mf->AddCacheDefinition
- ("CMAKE_BACKWARDS_COMPATIBILITY", "2.5",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmCacheManager::INTERNAL);
- }
- }
}
--- 159,162 ----
Index: cmCMakeMinimumRequired.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCMakeMinimumRequired.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmCMakeMinimumRequired.cxx 6 Mar 2008 15:57:03 -0000 1.16
--- cmCMakeMinimumRequired.cxx 7 Mar 2008 16:43:47 -0000 1.17
***************
*** 109,112 ****
--- 109,121 ----
}
+ if (required_major < 2 || required_major == 2 && required_minor < 4)
+ {
+ this->Makefile->SetPolicyVersion("2.4");
+ }
+ else
+ {
+ this->Makefile->SetPolicyVersion(version_string.c_str());
+ }
+
return true;
}
Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.364
retrieving revision 1.365
diff -C 2 -d -r1.364 -r1.365
*** cmake.cxx 4 Mar 2008 19:51:25 -0000 1.364
--- cmake.cxx 7 Mar 2008 16:43:47 -0000 1.365
***************
*** 1900,1903 ****
--- 1900,1916 ----
}
+ // set the default BACKWARDS compatibility to the current version
+ if(!this->CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+ {
+ char ver[256];
+ sprintf(ver,"%i.%i",cmVersion::GetMajorVersion(),
+ cmVersion::GetMinorVersion());
+ this->CacheManager->AddCacheEntry
+ ("CMAKE_BACKWARDS_COMPATIBILITY",ver,
+ "For backwards compatibility, what version of CMake commands and "
+ "syntax should this version of CMake allow.",
+ cmCacheManager::INTERNAL);
+ }
+
// no generator specified on the command line
if(!this->GlobalGenerator)
***************
*** 2381,2384 ****
--- 2394,2410 ----
}
+ // set the default BACKWARDS compatibility to the current version
+ if(!this->CacheManager->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+ {
+ char ver[256];
+ sprintf(ver,"%i.%i",cmVersion::GetMajorVersion(),
+ cmVersion::GetMinorVersion());
+ this->CacheManager->AddCacheEntry
+ ("CMAKE_BACKWARDS_COMPATIBILITY",ver,
+ "For backwards compatibility, what version of CMake commands and "
+ "syntax should this version of CMake allow.",
+ cmCacheManager::INTERNAL);
+ }
+
return 0;
}
Index: cmPolicies.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmPolicies.cxx 7 Mar 2008 13:40:36 -0000 1.13
--- cmPolicies.cxx 7 Mar 2008 16:43:47 -0000 1.14
***************
*** 185,188 ****
--- 185,212 ----
}
+ // it is an error if the policy version is less than 2.4
+ if (majorVer < 2 || majorVer == 2 && minorVer < 4)
+ {
+ mf->IssueError("An attempt was made to set the policy version of "
+ "CMake to something earlier than 2.4, this is an error!");
+ }
+
+ // if the version is 2.4 then make sure the backwards compatibility variable is visible
+ if (majorVer == 2 && minorVer == 4)
+ {
+ // set the default BACKWARDS compatibility to be visible
+ mf->GetCacheManager()->GetCacheIterator(
+ "CMAKE_BACKWARDS_COMPATIBILITY").SetType
+ (cmCacheManager::STRING);
+ // const char *cbcValue =
+ // mf->GetCacheManager()->
+ // GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY");
+ // mf->AddCacheDefinition
+ // ("CMAKE_BACKWARDS_COMPATIBILITY",cbcValue,
+ // "For backwards compatibility, what version of CMake commands and "
+ // "syntax should this version of CMake allow.",
+ // cmCacheManager::STRING);
+ }
+
// now loop over all the policies and set them as appropriate
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
More information about the Cmake-commits
mailing list