This is a dumb quick question I had with cmake_minimum_required
. I was reading the help page and saw that it could specify a maximum version. I made a silly CMakeLists.txt
:
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:
❯ 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?