summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-03-07 20:30:35 (GMT)
committerBrad King <brad.king@kitware.com>2008-03-07 20:30:35 (GMT)
commit5233b75a777b0f3379408291e6f32b0eb15c2f54 (patch)
tree538d48ac384f0129059e3e1c20f2a46e9a3949cf /Source/cmPolicies.cxx
parentfcce2f3b61ca5a3484d41aa804dc09b39f16f8cf (diff)
downloadCMake-5233b75a777b0f3379408291e6f32b0eb15c2f54.zip
CMake-5233b75a777b0f3379408291e6f32b0eb15c2f54.tar.gz
CMake-5233b75a777b0f3379408291e6f32b0eb15c2f54.tar.bz2
ENH: Improve handling of old-style compatibility.
- Remove CMP_0001 (no slash in target name) and restore old CMAKE_BACKWARDS_COMPATIBILITY check for it - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY with cmLocalGenerator::NeedBackwardsCompatibility calls - Create new CMP_0001 to determine whether or not CMAKE_BACKWARDS_COMPATIBILITY is used. (old = use, new = ignore) - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when CMP_0001 is set to OLD or WARN - Update documentation of cmake_policy and cmake_minimum_required to indicate their relationship and the 2.4 version boundary - When no cmake policy version is set in top level makefile implicitly call cmake_policy(VERSION 2.4) which restores CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility - Fix tests MakeClean and Preprocess to call cmake_policy(VERSION 2.6) because they depend on new policies
Diffstat (limited to 'Source/cmPolicies.cxx')
-rw-r--r--Source/cmPolicies.cxx86
1 files changed, 37 insertions, 49 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 79fecc3..bc123b1 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -84,7 +84,8 @@ public:
cmPolicies::cmPolicies()
{
// define all the policies
- this->DefinePolicy(CMP_0000, "CMP_0000",
+ this->DefinePolicy(
+ CMP_0000, "CMP_0000",
"Missing a CMake version specification. You must have a cmake_policy "
"call.",
"CMake requires that projects specify what version of CMake they have "
@@ -94,36 +95,32 @@ cmPolicies::cmPolicies()
"2.6 in that example with the verison of CMake you are writing to. "
"This policy is being put in place because it aids us in detecting "
"and maintaining backwards compatibility.",
- 2,6,0, cmPolicies::WARN);
-// this->PolicyStringMap["CMP_POLICY_SPECIFICATION"] = CMP_0000;
-
- this->DefinePolicy(CMP_0001, "CMP_0001",
- "CMake does not allow target names to include slash characters.",
- "CMake requires that target names not include any / or \\ characters "
- "please change the name of any targets to not use such characters."
- ,
- 2,4,0, cmPolicies::REQUIRED_IF_USED);
-// this->PolicyStringMap["CMP_TARGET_NAMES_WITH_SLASHES"] = CMP_0001;
-
- this->DefinePolicy(CMP_0002, "CMP_0002",
- "CMake requires that target names be globaly unique.",
- "CMake requires that target names not include any / or \\ characters "
- "please change the name of any targets to not use such characters."
- ,
- 2,6,0, cmPolicies::WARN);
-// this->PolicyStringMap["CMP_REQUIRE_UNIQUE_TARGET_NAMES"] = CMP_0002;
+ 2,6,0, cmPolicies::WARN
+ );
- this->DefinePolicy(CMP_0003, "CMP_0003",
- "CMake configures file immediately after 2.0.",
- "In CMake 2.0 and earlier the configure_file command would not "
- "configure the file until after processing all CMakeLists files. "
- "In CMake 2.2 and later the default behavior is that it will "
- "configure the file right when the command is invoked."
- ,
- 2,6,0, cmPolicies::NEW);
-// this->PolicyStringMap["CMP_CONFIGURE_FILE_IMMEDIATE"] = CMP_0003;
+ this->DefinePolicy(
+ CMP_0001, "CMP_0001",
+ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.",
+ "The OLD behavior is to check CMAKE_BACKWARDS_COMPATIBILITY and present "
+ "it to the user. "
+ "The NEW behavior is to ignore CMAKE_BACKWARDS_COMPATIBILITY "
+ "completely.\n"
+ "In CMake 2.4 and below the variable CMAKE_BACKWARDS_COMPATIBILITY was "
+ "used to request compatibility with earlier versions of CMake. "
+ "In CMake 2.6 and above all compatibility issues are handled by policies "
+ "and the cmake_policy command. "
+ "However, CMake must still check CMAKE_BACKWARDS_COMPATIBILITY for "
+ "projects written for CMake 2.4 and below.",
+ 2,6,0, cmPolicies::WARN
+ );
- }
+ this->DefinePolicy(
+ CMP_0002, "CMP_0002",
+ "CMake requires that target names be globaly unique.",
+ "....",
+ 2,6,0, cmPolicies::WARN
+ );
+}
cmPolicies::~cmPolicies()
{
@@ -187,27 +184,18 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// 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!");
+ mf->IssueError(
+ "An attempt was made to set the policy version of CMake to something "
+ "earlier than \"2.4\". "
+ "In CMake 2.4 and below backwards compatibility was handled with the "
+ "CMAKE_BACKWARDS_COMPATIBILITY variable. "
+ "In order to get compatibility features supporting versions earlier "
+ "than 2.4 set policy CMP_0001 to OLD to tell CMake to check the "
+ "CMAKE_BACKWARDS_COMPATIBILITY variable. "
+ "One way to so this is to set the policy version to 2.4 exactly."
+ );
}
-
- // 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
= this->Policies.begin();