Detect current CMake version using CMake : <p>I am working on a project that uses CMake. The top <code>CMakeLists.txt</code> file contains the following line:</p>

<pre><code>cmake_minimum_required(VERSION 3.7.2) # Kittens will die if you switch to an earlier version of CMake. We suggest using CMake 3.8.0.
</code></pre>

<p>I want to force all developers to switch to CMake 3.8.0, but for some reasons, not all developers have administration rights and are not able to switch from 3.7.2 to 3.8.0 immediately. Actually, we do not need any new features of version 3.8.0, but our policy is to use always the newest and greatest tools to prevent "porting up" problems in the future - for instance switching fast from Qt4 to Qt5 was a good decission in the past - I know switching always to the newest libraries and tools has also some drawbacks as discussed <a href="https://www.joelonsoftware.com/2002/01/06/fire-and-motion/" rel="noreferrer">here</a>, but we want to do it this way.</p>

<p>Because of this, instead of forcing everyone to use version 3.8.0, I'd like to output a warning message if CMake 3.7.2 is used. Somehow like this:</p>

<pre><code># not working - just pseudocode
if(CMAKE_VERSION == "3.7.2") 
    message("Please consider to switch to CMake 3.8.0")
endif()
</code></pre>

<p>I tried to read the <code>VERSION</code> variable, but this does not work. Does anyone now how this check can be achieved?</p>
