Commit 9bcc1b21 authored by Brad King's avatar Brad King
Browse files

Export: Fix internal CMake version test logic

Fix the internal DEVEL_CMAKE_VERSION macro to use CMake_VERSION_ENCODE
to compare version component-wise.  Otherwise an old invocation of the
macro may be tricked into using the current version when the requested
major version is smaller than the current version but the requested
minor version is larger.  It should use the requested (old) version in
that case.
parent d2059d25
......@@ -19,15 +19,17 @@
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmTargetExport.h"
#include "cmVersionConfig.h"
#include "cmVersionMacros.h"
#include "cmVersion.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) ? \
(CMake_VERSION_ENCODE(maj, min, patch) > \
CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, \
CMake_VERSION_PATCH) \
) ? \
STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \
STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \
: #maj "." #min "." #patch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment