# Help with cmake maximum version

**URL:** https://discourse.cmake.org/t/help-with-cmake-maximum-version/2797
**Category:** Code
**Created:** [February 18, 2021, 6:49pm UTC](https://discourse.cmake.org/t/help-with-cmake-maximum-version/2797 "2021-02-18T18:49:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [February 18, 2021, 6:49pm UTC](https://discourse.cmake.org/t/help-with-cmake-maximum-version/2797/1 "2021-02-18T18:49:34Z")

</div>

This is a dumb quick question I had with `cmake_minimum_required`. I was reading [the help page](https://cmake.org/cmake/help/v3.19/command/cmake_minimum_required.html) and saw that it could specify a maximum version. I made a silly `CMakeLists.txt`:

```cmake
cmake_minimum_required(VERSION 3.7...3.15)
project(test VERSION 1.0.0 LANGUAGES C)
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")

```

and then did:

```auto
❯ cmake --version
cmake version 3.19.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).
❯ cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_C_COMPILER: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mathomp4/CmakeTest/build

```

I was surprised it worked as I have CMake 3.19. But reading that help more closely, does the maximum version only affect `cmake_policy()` and not CMake as a whole for a project?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [February 19, 2021, 6:59am UTC](https://discourse.cmake.org/t/help-with-cmake-maximum-version/2797/2 "2021-02-19T06:59:53Z")

</div>

Yes, you’ve figured it out. Minimum version is enforced but maximum is only for the polices. It’s like saying “I’ve tested this thing with the max declared version, so please set the polices according to that version”.
