summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3e1436f..78db8ed 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -56,6 +56,8 @@ cmLocalGenerator::cmLocalGenerator()
this->IsMakefileGenerator = false;
this->RelativePathsConfigured = false;
this->PathConversionsSetup = false;
+ this->BackwardsCompatibility = 0;
+ this->BackwardsCompatibilityFinal = false;
}
cmLocalGenerator::~cmLocalGenerator()
@@ -2860,3 +2862,42 @@ cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* ,
cmSystemTools::Error("GetTargetObjectFileDirectories"
" called on cmLocalGenerator");
}
+
+//----------------------------------------------------------------------------
+unsigned int cmLocalGenerator::GetBackwardsCompatibility()
+{
+ // The computed version may change until the project is fully
+ // configured.
+ if(!this->BackwardsCompatibilityFinal)
+ {
+ unsigned int major = 0;
+ unsigned int minor = 0;
+ unsigned int patch = 0;
+ if(const char* value
+ = this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"))
+ {
+ switch(sscanf(value, "%u.%u.%u", &major, &minor, &patch))
+ {
+ case 2: patch = 0; break;
+ case 1: minor = 0; patch = 0; break;
+ default: break;
+ }
+ }
+ this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
+ this->BackwardsCompatibilityFinal = this->Configured;
+ }
+
+ return this->BackwardsCompatibility;
+}
+
+//----------------------------------------------------------------------------
+bool cmLocalGenerator::NeedBackwardsCompatibility(unsigned int major,
+ unsigned int minor,
+ unsigned int patch)
+{
+ // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
+ // equal to or lower than the given version.
+ unsigned int actual_compat = this->GetBackwardsCompatibility();
+ return (actual_compat &&
+ actual_compat <= CMake_VERSION_ENCODE(major, minor, patch));
+}