# Minimum required version of CMake updated to 3.5.0

**URL:** <https://discourse.slicer.org/t/minimum-required-version-of-cmake-updated-to-3-5-0/828>\
**Category:** Development\
**Tags:** build\
**Created:** [August 4, 2017, 6:44pm UTC](https://discourse.slicer.org/t/minimum-required-version-of-cmake-updated-to-3-5-0/828 "2017-08-04T18:44:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 4, 2017, 6:44pm UTC](https://discourse.slicer.org/t/minimum-required-version-of-cmake-updated-to-3-5-0/828/1 "2017-08-04T18:44:29Z")

</div>

As discussed in PR [Slicer/Slicer#765](https://github.com/Slicer/Slicer/pull/765), the minimum version of CMake required to build Slicer is now **CMake 3.5.0**

Associated changes integrated in [r26201](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26201), [r26202](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26202) and [r26203](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26203)

This will ensure the CMake version has:

- support for VS 2015 (introduced in CMake 3.1)
- a decent support for detecting [compiler features](https://cmake.org/cmake/help/v3.5/manual/cmake-compile-features.7.html) (useful with C++11 and above)
- as well as support for modern cmake that will be used to modernize the Slicer build system. See [here](https://cmake.org/cmake/help/v3.5/manual/cmake-buildsystem.7.html#build-specification-and-usage-requirements) and below.

CMake 3.5 is also old enough (released in April 2016) and available (same version  
or above) in distributions like these ones:

- Arch Linux
- Ubuntu LTS 14.04, 16.04
- OpenSUSE Leap 42.2, 42.3
- Debian 9, Sid
- Fedora 24/25/26
- Slackware 14.2

See [https://pkgs.org/download/cmake](https://pkgs.org/download/cmake)

Note that the statement `cmake_minimum_required(VERSION 3.5)` does **NOT** need to be updated in the extension source trees.

That said:

- whenever possible, extension developer are encouraged to update it in the top level `CMakeLists.txt`. This will most likely avoid confusion …

- the version of CMake used to build the extension need to be 3.5. To facilitate the overall maintenance, this is a hard requirement (an explicit `cmake_minimum_required(VERSION 3.5)` statement was added to `SlicerConfig.cmake` and `UseSlicer.cmake`

If you are interested, this presentation from Tobias Becker is a nice introduction to modern CMake:

> **[Modern CMake](https://docs.google.com/presentation/d/18fY0zDtJCMUW5WdY2ZOfKtvb7lXEbBPFe_I6MNJC0Qw/edit#slide=id.p)**
>
> Prerequisites: cmake &gt;= 3.5 git https://github.com/toeb/moderncmake.git 1
