mirror of
1
0
Fork 0

Update to CMake 3.15

This commit is contained in:
Henry Fredrick Schreiner 2019-07-18 00:37:04 -04:00
parent 30c83f03e8
commit 5a23bc2438
7 changed files with 34 additions and 15 deletions

View File

@ -4,7 +4,7 @@ test_code:
stage: test stage: test
before_script: before_script:
- mkdir -p $HOME/.local - mkdir -p $HOME/.local
- curl -s "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local - curl -s "https://cmake.org/files/v3.15/cmake-3.15.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:
- mkdir -p build - mkdir -p build

View File

@ -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.14+! I'm talking about Modern CMake. CMake 3.1+, maybe even CMake 3.15+!
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!

View File

@ -11,6 +11,7 @@
"substitutes": [ "substitutes": [
{"pattern": "«cmake:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/manual/cmake-$1.7.html)"}, {"pattern": "«cmake:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/manual/cmake-$1.7.html)"},
{"pattern": "«command:`?([^`^»]+)`?»", "flags": "g", "substitute": "[`$1`](https://cmake.org/cmake/help/latest/command/$1.html)"}, {"pattern": "«command:`?([^`^»]+)`?»", "flags": "g", "substitute": "[`$1`](https://cmake.org/cmake/help/latest/command/$1.html)"},
{"pattern": "«envvar:`?([^`^»]+)`?»", "flags": "g", "substitute": "[`$1`](https://cmake.org/cmake/help/latest/envvar/$1.html)"},
{"pattern": "«module:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/module/$1.html)"}, {"pattern": "«module:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/module/$1.html)"},
{"pattern": "«policy:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/policy/$1.html)"}, {"pattern": "«policy:([^`^»]+)»", "flags": "g", "substitute": "[$1](https://cmake.org/cmake/help/latest/policy/$1.html)"},
{"pattern": "«variable:`?([^`^»]+)`?»", "flags": "g", "substitute": "[`$1`](https://cmake.org/cmake/help/latest//$1.html)"}, {"pattern": "«variable:`?([^`^»]+)`?»", "flags": "g", "substitute": "[`$1`](https://cmake.org/cmake/help/latest//$1.html)"},

View File

@ -19,7 +19,7 @@ usually have a very recent version of CMake.
This is what new projects should do: This is what new projects should do:
```cmake ```cmake
cmake_minimum_required(VERSION 3.1...3.14) cmake_minimum_required(VERSION 3.1...3.15)
if(${CMAKE_VERSION} VERSION_LESS 3.12) if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
@ -33,10 +33,10 @@ WARNING: MSVC's CMake server mode [originally had a bug](https://github.com/fmtl
```cmake ```cmake
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
if(${CMAKE_VERSION} VERSION_LESS 3.14) if(${CMAKE_VERSION} VERSION_LESS 3.15)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else() else()
cmake_policy(VERSION 3.14) cmake_policy(VERSION 3.15)
endif() endif()
``` ```

View File

@ -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.14 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.15 support...
## Official package ## Official package
@ -13,14 +13,14 @@ You can [download CMake from KitWare][cmake-download]. This is how you'll probab
On Linux, there are 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 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.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local ~ $ wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.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.14 && wget -qO- "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.14 ~ $ mkdir -p cmake-3.15 && wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.15
~ $ export PATH=`pwd`/cmake-3.14/bin:$PATH ~ $ export PATH=`pwd`/cmake-3.15/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.
@ -28,7 +28,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.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local docker $ wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
{% endterm %} {% endterm %}
@ -51,9 +51,9 @@ Here are some common build environments and the CMake version you'll find on the
| [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 | |
| [Python PyPI](https://pypi.org/project/cmake/) | 3.13.3 | Just `pip install cmake` on many systems. Add `--user` for local installs. | | [Python PyPI](https://pypi.org/project/cmake/) | 3.13.3 | Just `pip install cmake` on many systems. Add `--user` for local installs. |
| [Anaconda](https://anaconda.org/anaconda/cmake) | 3.14.0 | For use with Conda | | [Anaconda](https://anaconda.org/anaconda/cmake) | 3.14.0 | For use with Conda |
| [Conda-Forge](https://github.com/conda-forge/cmake-feedstock) | latest | For use with Conda | | [Conda-Forge](https://github.com/conda-forge/cmake-feedstock) | 3.14.5 | For use with Conda |
| [Homebrew on macOS](https://formulae.brew.sh/formula/cmake) | latest | On macOS with Homebrew, this is only a few minutes behind cmake.org. | | [Homebrew on macOS](https://formulae.brew.sh/formula/cmake) | 3.15.0 | On macOS with Homebrew, this is only a few minutesa behind cmake.org. |
| [Chocolaty on Windows](https://chocolatey.org/packages/cmake) | latest | Also up to date. The normal cmake.org installers are common on Windows, as well. | | [Chocolaty on Windows](https://chocolatey.org/packages/cmake) | 3.14.6 | Also up to date. The normal cmake.org installers are common on Windows, as well. |
| TravisCI Trusty | 3.9 | The December 2017 update added a recent version of clang and CMake! Finally! | | TravisCI Trusty | 3.9 | The December 2017 update added a recent version of clang and CMake! Finally! |
| TravisCI Xenial | 3.12.4 | Mid November 2018 this image became ready for widescale use. | | TravisCI Xenial | 3.12.4 | Mid November 2018 this image became ready for widescale use. |

View File

@ -74,7 +74,7 @@ This release added Clang-Tidy support, along with more utilities and improvement
## [CMake 3.7][] : Android & CMake Server ## [CMake 3.7][] : Android & CMake Server
You can now cross-compile to Android. Useful new if statement options really help clarify code. And the new server mode should (eventually?) improve integration with IDEs. Support for the VIM editor was also improved. You can now cross-compile to Android. Useful new if statement options really help clarify code. And the new server mode was supposed to improve integration with IDEs (but is being replaced by a different system in CMake 3.14+). Support for the VIM editor was also improved.
* `PARSE_ARGV` mode for `cmake_parse_arguments` * `PARSE_ARGV` mode for `cmake_parse_arguments`
* Better 32-bit support on 64-bit machines * Better 32-bit support on 64-bit machines
@ -188,6 +188,23 @@ Quite a few more find packages produce targets. The new Visual Studio 16 2019 ge
* «command:get_filename_component» gained `LAST_EXT` and `NAME_WLE` to access just the *last* extension on a file, which would get `.zip` on a file such as `version.1.2.zip` (very handy!) * «command:get_filename_component» gained `LAST_EXT` and `NAME_WLE` to access just the *last* extension on a file, which would get `.zip` on a file such as `version.1.2.zip` (very handy!)
* You can see if a variable is defined in the CACHE with `DEFINED CACHE{VAR}` in an «command:if» statement. * You can see if a variable is defined in the CACHE with `DEFINED CACHE{VAR}` in an «command:if» statement.
* `BUILD_RPATH_USE_ORIGIN` and CMake version were added to improve handling of RPath in the build directory. * `BUILD_RPATH_USE_ORIGIN` and CMake version were added to improve handling of RPath in the build directory.
* The CMake server mode is now being replaced with a file API, starting in this release. Will affect IDEs in the long run.
## [CMake 3.15][] : CLI upgrade
This release has many smaller polishing changes, include several of improvements to the CMake command line, such as control over the default generator through environment variables (so now it's easy to change the default generator to Ninja). Multiple targets and `--install` are supported in `--build` mode. CMake finally supports multiple levels of logging. Generator expressions gained a few handy tools. The still very new FindPython module continues to improve, and FindBoost is now more inline with Boost 1.70's new CONFIG
module. `export(PACKAGE)` has drastically changed; it now no longer touches `$HOME/.cmake` by default (if CMake Minimum version is 3.15 or higher), and requires an extra step if a user wants to use it. This is generally less surprising.
* «envvar:CMAKE_GENERATOR» environment variable added to control default generator
* Multiple target support in build mode, `cmake . --build --target a b`
* Install support, `cmake . --install`
* Support for `--loglevel` and `NOTICE`, `VERBOSE`, `DEBUG`, and `TRACE` for `message`
* The «command:list» command gained `PREPEND`, `POP_FRONT`, and `POP_BACK`
* «command:execute_process» gained `COMMAND_ECHO` option («variable:CMAKE_EXECUTE_PROCESS_COMMAND_ECHO») allows you to automatically echo commands before running them
* Several Ninja improvements, include SWIFT language support
* Compiler and list improvements to generator expressions
[Releases]: https://cmake.org/cmake/help/latest/release/index.html [Releases]: https://cmake.org/cmake/help/latest/release/index.html
[CMake 3.0]: https://cmake.org/cmake/help/latest/release/3.0.html [CMake 3.0]: https://cmake.org/cmake/help/latest/release/3.0.html
@ -205,4 +222,5 @@ Quite a few more find packages produce targets. The new Visual Studio 16 2019 ge
[CMake 3.12]: https://cmake.org/cmake/help/latest/release/3.12.html [CMake 3.12]: https://cmake.org/cmake/help/latest/release/3.12.html
[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
[fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/ [fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/

View File

@ -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.14) cmake_minimum_required(VERSION 3.1...3.15)
# 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