New CMake version
This commit is contained in:
parent
504b20db3f
commit
380a04df34
@ -6,7 +6,7 @@ test_code:
|
|||||||
- yum install -y make cmake boost-devel git
|
- yum install -y make cmake boost-devel git
|
||||||
# will install latest CMake, even though Fedora has a recent one
|
# will install latest CMake, even though Fedora has a recent one
|
||||||
- mkdir -p $HOME/.local
|
- mkdir -p $HOME/.local
|
||||||
- curl -s "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local
|
- curl -s "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local
|
||||||
- export PATH=$HOME/.local/bin:$PATH
|
- export PATH=$HOME/.local/bin:$PATH
|
||||||
script:
|
script:
|
||||||
- cmake -S examples -B build
|
- cmake -S examples -B build
|
||||||
|
@ -7,7 +7,7 @@ Certainly there are no shortage of problems when building.
|
|||||||
But I think that, in 2018, we have a very good solution to quite a few of those problems.
|
But I think that, in 2018, we have a very good solution to quite a few of those problems.
|
||||||
It's CMake. Not CMake 2.8 though; that was released before C++11 even existed!
|
It's CMake. Not CMake 2.8 though; that was released before C++11 even existed!
|
||||||
Nor the horrible examples out there for CMake (even those posted on KitWare's own tutorials list).
|
Nor the horrible examples out there for CMake (even those posted on KitWare's own tutorials list).
|
||||||
I'm talking about Modern CMake. CMake 3.1+, maybe even CMake 3.15+!
|
I'm talking about Modern CMake. CMake 3.1+, maybe even CMake 3.16+!
|
||||||
It's clean, powerful, and elegant, so you can spend most of your time coding, not adding lines to an unreadable, unmaintainable Make (Or CMake 2) file.
|
It's clean, powerful, and elegant, so you can spend most of your time coding, not adding lines to an unreadable, unmaintainable Make (Or CMake 2) file.
|
||||||
And CMake 3.11+ is supposed to be significantly faster, as well!
|
And CMake 3.11+ is supposed to be significantly faster, as well!
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Your CMake version should be newer than your compiler. It should be newer than the libraries you are using (especially Boost). New versions work better for everyone.
|
Your CMake version should be newer than your compiler. It should be newer than the libraries you are using (especially Boost). New versions work better for everyone.
|
||||||
{% endhint %}
|
{% endhint %}
|
||||||
|
|
||||||
If you have a built in copy of CMake, it isn't special or customized for your system. You can easily install a new one instead, either on the system level or the user level. Feel free to instruct your users here if they complain about a CMake requirement being set too high. Especially if they want < 3.1 support. Maybe even if they want CMake < 3.15 support...
|
If you have a built in copy of CMake, it isn't special or customized for your system. You can easily install a new one instead, either on the system level or the user level. Feel free to instruct your users here if they complain about a CMake requirement being set too high. Especially if they want < 3.1 support. Maybe even if they want CMake < 3.16 support...
|
||||||
|
|
||||||
#### Quick list (more info on each method below)
|
#### Quick list (more info on each method below)
|
||||||
|
|
||||||
@ -32,14 +32,14 @@ You can [download CMake from KitWare][download]. This is how you will probably g
|
|||||||
On Linux, there are several options. Kitware provides a [Debian/Ubunutu apt repository][apt], as well as [snap packages][snap]. There are universal Linux binaries provided, but you'll need to pick an install location. If you already use `~/.local` for user-space packages, the following single line command[^1] will get CMake for you [^2]:
|
On Linux, there are several options. Kitware provides a [Debian/Ubunutu apt repository][apt], as well as [snap packages][snap]. There are universal Linux binaries provided, but you'll need to pick an install location. If you already use `~/.local` for user-space packages, the following single line command[^1] will get CMake for you [^2]:
|
||||||
|
|
||||||
{% term %}
|
{% term %}
|
||||||
~ $ wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local
|
~ $ wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local
|
||||||
{% endterm %}
|
{% endterm %}
|
||||||
|
|
||||||
If you just want a local folder with CMake only:
|
If you just want a local folder with CMake only:
|
||||||
|
|
||||||
{% term %}
|
{% term %}
|
||||||
~ $ mkdir -p cmake-3.15 && wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.15
|
~ $ mkdir -p cmake-3.16 && wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.16
|
||||||
~ $ export PATH=`pwd`/cmake-3.15/bin:$PATH
|
~ $ export PATH=`pwd`/cmake-3.16/bin:$PATH
|
||||||
{% endterm %}
|
{% endterm %}
|
||||||
|
|
||||||
You'll obviously want to append to the PATH every time you start a new terminal, or add it to your `.bashrc` or to an [LMod] system.
|
You'll obviously want to append to the PATH every time you start a new terminal, or add it to your `.bashrc` or to an [LMod] system.
|
||||||
@ -47,7 +47,7 @@ You'll obviously want to append to the PATH every time you start a new terminal,
|
|||||||
And, if you want a system install, install to `/usr/local`; this is an excellent choice in a Docker container, for example on GitLab CI. Do not try it on a non-containerized system.
|
And, if you want a system install, install to `/usr/local`; this is an excellent choice in a Docker container, for example on GitLab CI. Do not try it on a non-containerized system.
|
||||||
|
|
||||||
{% term %}
|
{% term %}
|
||||||
docker $ wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
|
docker $ wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
|
||||||
{% endterm %}
|
{% endterm %}
|
||||||
|
|
||||||
|
|
||||||
@ -62,12 +62,14 @@ Here are some common build environments and the CMake version you'll find on the
|
|||||||
| Distribution | CMake version | Notes |
|
| Distribution | CMake version | Notes |
|
||||||
|---------------|---------------|-------|
|
|---------------|---------------|-------|
|
||||||
| [RHEL/CentOS 7](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake) | 2.8.11 | Don't use the default on this system. Grab a new copy or use the EPEL repo. |
|
| [RHEL/CentOS 7](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake) | 2.8.11 | Don't use the default on this system. Grab a new copy or use the EPEL repo. |
|
||||||
|
| [RHEL/CentOS 8](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake) | 3.11.4 | Not too bad. |
|
||||||
| [EPEL for RHEL/CentOS](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake3) | 3.13.4 | Called `cmake3` |
|
| [EPEL for RHEL/CentOS](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake3) | 3.13.4 | Called `cmake3` |
|
||||||
| [Ubuntu 14.04 LTS: Trusty](https://launchpad.net/ubuntu/trusty/+source/cmake) | 2.8.12 | Don't use the default on this system. |
|
| [Ubuntu 14.04 LTS: Trusty](https://launchpad.net/ubuntu/trusty/+source/cmake) | 2.8.12 | Don't use the default on this system. |
|
||||||
| [Ubuntu 16.04 LTS: Xenial](https://launchpad.net/ubuntu/xenial/+source/cmake) | 3.5.1 | |
|
| [Ubuntu 16.04 LTS: Xenial](https://launchpad.net/ubuntu/xenial/+source/cmake) | 3.5.1 | |
|
||||||
| [Ubuntu 18.04 LTS: Bionic](https://launchpad.net/ubuntu/bionic/+source/cmake) | 3.10.2 | An LTS with a pretty decent minimum version! |
|
| [Ubuntu 18.04 LTS: Bionic](https://launchpad.net/ubuntu/bionic/+source/cmake) | 3.10.2 | An LTS with a pretty decent minimum version! |
|
||||||
| [Ubuntu 18.10: Cosmic](https://launchpad.net/ubuntu/cosmic/+source/cmake) | 3.12.1 | |
|
| [Ubuntu 18.10: Cosmic](https://launchpad.net/ubuntu/cosmic/+source/cmake) | 3.12.1 | |
|
||||||
| [Ubuntu 19.04: Disco](https://launchpad.net/ubuntu/disco/+source/cmake) | 3.13.4 | |
|
| [Ubuntu 19.04: Disco](https://launchpad.net/ubuntu/disco/+source/cmake) | 3.13.4 | |
|
||||||
|
| [Ubuntu 19.10: Eoan](https://launchpad.net/ubuntu/eoan/+source/cmake) | 3.13.4 | Oddly identical to Disco. |
|
||||||
| [AlpineLinux 3.10](https://pkgs.alpinelinux.org/packages?name=cmake&branch=v3.10)| 3.14.5 | Useful in Docker |
|
| [AlpineLinux 3.10](https://pkgs.alpinelinux.org/packages?name=cmake&branch=v3.10)| 3.14.5 | Useful in Docker |
|
||||||
| [Python PyPI][PyPI] | 3.15.3 | Just `pip install cmake` on many systems. Add `--user` for local installs. (ManyLinux1 (old pip or OS) gets CMake 3.13.3)|
|
| [Python PyPI][PyPI] | 3.15.3 | Just `pip install cmake` on many systems. Add `--user` for local installs. (ManyLinux1 (old pip or OS) gets CMake 3.13.3)|
|
||||||
| [Anaconda][] | 3.14.0 | For use with Conda |
|
| [Anaconda][] | 3.14.0 | For use with Conda |
|
||||||
|
@ -207,10 +207,15 @@ module. `export(PACKAGE)` has drastically changed; it now no longer touches `$HO
|
|||||||
* Several Ninja improvements, include SWIFT language support
|
* Several Ninja improvements, include SWIFT language support
|
||||||
* Compiler and list improvements to generator expressions
|
* Compiler and list improvements to generator expressions
|
||||||
|
|
||||||
## [CMake 3.16][] : IN DEVELOPMENT
|
## [CMake 3.16][] : Unity builds
|
||||||
|
|
||||||
|
A new unity build mode was added, allowing source files to be merged into a single build file. Support for
|
||||||
|
precompiled headers (possibly preparing for C++20 modules, perhaps?) was added. Lots of other smaller
|
||||||
|
fixes were implemented, especially to newer features, such as to FindPython, FindDoxygen, and others.
|
||||||
|
|
||||||
|
* Added support for Objective C and Objective C++ languages
|
||||||
* Support for precompiling headers, with `target_precompile_headers`
|
* Support for precompiling headers, with `target_precompile_headers`
|
||||||
* Support for "Unity" or "Jumbo" builds (merging source files) with `CMAKE_UNITY_BUILD`
|
* Support for "Unity" or "Jumbo" builds (merging source files) with «variable:CMAKE_UNITY_BUILD»
|
||||||
* CTest: Can now skip based on regex, expand lists
|
* CTest: Can now skip based on regex, expand lists
|
||||||
* Several new features to control RPath.
|
* Several new features to control RPath.
|
||||||
* Generator expressions work in more places, like build and install paths
|
* Generator expressions work in more places, like build and install paths
|
||||||
@ -234,5 +239,5 @@ module. `export(PACKAGE)` has drastically changed; it now no longer touches `$HO
|
|||||||
[CMake 3.13]: https://cmake.org/cmake/help/latest/release/3.13.html
|
[CMake 3.13]: https://cmake.org/cmake/help/latest/release/3.13.html
|
||||||
[CMake 3.14]: https://cmake.org/cmake/help/latest/release/3.14.html
|
[CMake 3.14]: https://cmake.org/cmake/help/latest/release/3.14.html
|
||||||
[CMake 3.15]: https://cmake.org/cmake/help/latest/release/3.15.html
|
[CMake 3.15]: https://cmake.org/cmake/help/latest/release/3.15.html
|
||||||
[CMake 3.16]: https://cmake.org/cmake/help/git-master/release/index.html
|
[CMake 3.16]: https://cmake.org/cmake/help/latest/release/3.16.html
|
||||||
[fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/
|
[fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.11...3.15)
|
cmake_minimum_required(VERSION 3.11...3.16)
|
||||||
|
|
||||||
project(ModernCMakeExamples)
|
project(ModernCMakeExamples)
|
||||||
set(MODERN_CMAKE_BUILD_TESTING ON)
|
set(MODERN_CMAKE_BUILD_TESTING ON)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Works with 3.11 and tested through 3.15
|
# Works with 3.11 and tested through 3.15
|
||||||
cmake_minimum_required(VERSION 3.11...3.15)
|
cmake_minimum_required(VERSION 3.11...3.16)
|
||||||
|
|
||||||
# Project name and a few useful settings. Other commands can pick up the results
|
# Project name and a few useful settings. Other commands can pick up the results
|
||||||
project(ModernCMakeExample
|
project(ModernCMakeExample
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
## [main]
|
## [main]
|
||||||
cmake_minimum_required(VERSION 3.4...3.15)
|
cmake_minimum_required(VERSION 3.4...3.16)
|
||||||
|
|
||||||
project(RootDictExample LANGUAGES CXX)
|
project(RootDictExample LANGUAGES CXX)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
## [main]
|
## [main]
|
||||||
cmake_minimum_required(VERSION 3.1...3.15)
|
cmake_minimum_required(VERSION 3.1...3.16)
|
||||||
|
|
||||||
project(RootSimpleExample LANGUAGES CXX)
|
project(RootSimpleExample LANGUAGES CXX)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
## [main]
|
## [main]
|
||||||
cmake_minimum_required(VERSION 3.1...3.15)
|
cmake_minimum_required(VERSION 3.1...3.16)
|
||||||
|
|
||||||
project(RootUseFileExample LANGUAGES CXX)
|
project(RootUseFileExample LANGUAGES CXX)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# You should always specify a range with the newest
|
# You should always specify a range with the newest
|
||||||
# and oldest tested versions of CMake. This will ensure
|
# and oldest tested versions of CMake. This will ensure
|
||||||
# you pick up the best policies.
|
# you pick up the best policies.
|
||||||
cmake_minimum_required(VERSION 3.1...3.15)
|
cmake_minimum_required(VERSION 3.1...3.16)
|
||||||
|
|
||||||
# This is your project statement. You should always list languages;
|
# This is your project statement. You should always list languages;
|
||||||
# Listing the version is nice here since it sets lots of useful variables
|
# Listing the version is nice here since it sets lots of useful variables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user