Browse Source

Export: Use a macro to ensure minimum development version requirement

Use the version number of the specified release, or of the current
development version if the release is not yet made.
Stephen Kelly 12 years ago
parent
commit
eaf703f160
1 changed files with 13 additions and 1 deletions
  1. 13 1
      Source/cmExportInstallFileGenerator.cxx

+ 13 - 1
Source/cmExportInstallFileGenerator.cxx

@@ -19,6 +19,18 @@
 #include "cmInstallExportGenerator.h"
 #include "cmInstallTargetGenerator.h"
 #include "cmTargetExport.h"
+#include "cmVersionConfig.h"
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+#define DEVEL_CMAKE_VERSION(maj, min, patch) \
+  (maj > CMake_VERSION_MAJOR \
+  || min > CMake_VERSION_MINOR \
+  || patch > CMake_VERSION_PATCH) ? \
+    STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \
+    STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \
+  : #maj "." #min "." #patch
 
 //----------------------------------------------------------------------------
 cmExportInstallFileGenerator
@@ -176,7 +188,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 
   if (require3_0_0)
     {
-    this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007");
+    this->GenerateRequiredCMakeVersion(os, DEVEL_CMAKE_VERSION(3, 0, 0));
     }
   else if (require2_8_12)
     {