mirror of
1
0
Fork 0

Merge branch 'henryiii/chore/3.21.0' into 'master'

Henryiii/chore/3.21.0

See merge request CLIUtils/modern-cmake!54
This commit is contained in:
Henry Schreiner 2021-07-14 17:17:15 +00:00
commit 62f8f1b7ef
13 changed files with 54 additions and 26 deletions

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.20.5
current_version = 3.21.0
[bumpversion:file:.gitlab-ci.yml]
search = cmake-{current_version}-linux

View File

@ -5,7 +5,7 @@ test_code:
- apt-get update && apt-get install -y make cmake libboost-dev git
# We will install latest CMake, even though Ubuntu has a recent one
- mkdir -p $HOME/.local
- curl -s "https://cmake.org/files/v3.20/cmake-3.20.5-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local
- curl -s "https://cmake.org/files/v3.21/cmake-3.21.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local
- export PATH=$HOME/.local/bin:$PATH
script:
- cmake -S examples -B build

View File

@ -7,7 +7,7 @@ Certainly there are no shortage of problems when building.
But I think that, in 2020, 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!
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.4+, maybe even CMake 3.20+!
I'm talking about Modern CMake. CMake 3.4+, maybe even CMake 3.21+!
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!

View File

@ -36,7 +36,7 @@ Windows users, who also usually have a very recent version of CMake.
This is what new projects should do:
```cmake
cmake_minimum_required(VERSION 3.7...3.20)
cmake_minimum_required(VERSION 3.7...3.21)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
@ -56,10 +56,10 @@ you will want to do this instead:
```cmake
cmake_minimum_required(VERSION 3.7)
if(${CMAKE_VERSION} VERSION_LESS 3.20)
if(${CMAKE_VERSION} VERSION_LESS 3.21)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.20)
cmake_policy(VERSION 3.21)
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.
{% 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 3.20+ 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 3.21+ support...
#### Quick list (more info on each method below)
@ -34,14 +34,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]:
{% term %}
~ $ wget -qO- "https://cmake.org/files/v3.20/cmake-3.20.5-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local
~ $ wget -qO- "https://cmake.org/files/v3.21/cmake-3.21.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local
{% endterm %}
The names changed in 3.20; older releases had names like `cmake-3.19.7-Linux-x86_64.tar.gz`. If you just want a local folder with CMake only:
The names changed in 3.21; older releases had names like `cmake-3.19.7-Linux-x86_64.tar.gz`. If you just want a local folder with CMake only:
{% term %}
~ $ mkdir -p cmake-3.20 && wget -qO- "https://cmake.org/files/v3.20/cmake-3.20.5-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.20
~ $ export PATH=`pwd`/cmake-3.20/bin:$PATH
~ $ mkdir -p cmake-3.21 && wget -qO- "https://cmake.org/files/v3.21/cmake-3.21.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.21
~ $ export PATH=`pwd`/cmake-3.21/bin:$PATH
{% 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.
@ -49,7 +49,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.
{% term %}
docker $ wget -qO- "https://cmake.org/files/v3.20/cmake-3.20.5-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
docker $ wget -qO- "https://cmake.org/files/v3.21/cmake-3.21.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
{% endterm %}

View File

@ -305,20 +305,47 @@ for permissions. Further support for generator expressions in more places.
* FindPython: `Python*_LINK_OPTIONS` added
* `compute-sanitizer` for ctest now supports CUDA for memcheck
## [CMake 3.20][] : ...
## [CMake 3.20][] : Docs
The CMake docs received a major boost in productivity by adding "new in" tags
to quickly see what was added without having to toggle documentation versions!
C++ 23 support added. Source files must have the extension listed now, and
LANGUAGE is always respected. Quite a bit of cleanup was done; make sure your
code is tested with `...3.20` before deploying that as your maximum.
code is tested with `...3.20` before deploying that as your maximum. Presets
continue to be improved.
* Support added for C++23
* CUDAARCHS environment variable for setting CUDA architectures.
* The new `IntelLLVM` compilers are now supported (OneAPI 2021.1), and `NVHPC` NVIDIA HPC SDK, as well.
* Some expanded generator expression support in custom commands/targets, install renaming.
* New `cmake_path` command for working with paths.
* CUDAARCHS environment variable for setting CUDA architectures
* The new `IntelLLVM` compilers are now supported (OneAPI 2021.1), and `NVHPC` NVIDIA HPC SDK, as well
* Some expanded generator expression support in custom commands/targets, install renaming
* New `cmake_path` command for working with paths
* `try_run` now has a `WORKING_DIRECTORY`
* More features for the `file(GENERATE` command
* Several removals, like `cmake-server`, `WriteCompilerDetectionHeader` (if policy set to 3.20+), and a few things that have newer methods now.
* Source files must include the extension
## [CMake 3.21][] : Colors
Different message types now have different colors! There's now a nice variable
to see if you are in the top level project. Lots of continued cleanup and
specialized new features, such as adding the HIP language and C17 and C23
support. Presets continue to be improved.
* Preliminary support for MSVC 2022
* `CMAKE_<LANG_LINKER_LAUNCHER` added for make and ninja
* HIP added as a language
* C17 and C23 support added
* `--instal-prefix <dir>` and `--toolchain <file>` added when running CMake
* Messages printed are colored by message type!
* Support for MSYS, including `FindMsys`
* The `file(` command got several updates, including `EXPAND_TILDE`
* Support for runtime dependencies and artifacts added to `install`
* `PROJECT_IS_TOP_LEVEL` and `<PROJECT-NAME>_IS_TOP_LEVEL` finally added
* Caching improvements for the `find_` commands
[Releases]: https://cmake.org/cmake/help/latest/release/index.html
@ -343,6 +370,7 @@ code is tested with `...3.20` before deploying that as your maximum.
[CMake 3.18]: https://cmake.org/cmake/help/latest/release/3.18.html
[CMake 3.19]: https://cmake.org/cmake/help/latest/release/3.19.html
[CMake 3.20]: https://cmake.org/cmake/help/latest/release/3.20.html
[CMake 3.21]: https://cmake.org/cmake/help/latest/release/3.21.html
[CMake master]: https://cmake.org/cmake/help/git-master/release/index.html
[fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11...3.20)
cmake_minimum_required(VERSION 3.11...3.21)
project(ModernCMakeExamples)
set(MODERN_CMAKE_BUILD_TESTING ON)

View File

@ -1,5 +1,5 @@
# Works with 3.11 and tested through 3.20
cmake_minimum_required(VERSION 3.11...3.20)
# Works with 3.11 and tested through 3.21
cmake_minimum_required(VERSION 3.11...3.21)
# Project name and a few useful settings. Other commands can pick up the results
project(

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14...3.20)
cmake_minimum_required(VERSION 3.14...3.21)
project(FetchExample LANGUAGES CXX)

View File

@ -2,7 +2,7 @@
## [main]
cmake_minimum_required(VERSION 3.4...3.20)
cmake_minimum_required(VERSION 3.4...3.21)
project(RootDictExample LANGUAGES CXX)

View File

@ -1,7 +1,7 @@
# CMake ROOT simple example
## [main]
cmake_minimum_required(VERSION 3.1...3.20)
cmake_minimum_required(VERSION 3.1...3.21)
project(RootSimpleExample LANGUAGES CXX)

View File

@ -1,7 +1,7 @@
# CMake ROOT usefile example
## [main]
cmake_minimum_required(VERSION 3.1...3.20)
cmake_minimum_required(VERSION 3.1...3.21)
project(RootUseFileExample LANGUAGES CXX)

View File

@ -6,7 +6,7 @@
# You should always specify a range with the newest
# and oldest tested versions of CMake. This will ensure
# you pick up the best policies.
cmake_minimum_required(VERSION 3.1...3.20)
cmake_minimum_required(VERSION 3.1...3.21)
# This is your project statement. You should always list languages;
# Listing the version is nice here since it sets lots of useful variables