1
0
mirror of synced 2024-12-22 12:40:00 +01:00

chore: bump to CMake 3.23

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner 2022-03-29 16:41:40 -04:00
parent 6020c1c22b
commit 570c7b64bf
No known key found for this signature in database
GPG Key ID: B9D0E45146A241E8
13 changed files with 48 additions and 22 deletions

View File

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 3.22.1 current_version = 3.23.0
[bumpversion:file:.gitlab-ci.yml] [bumpversion:file:.gitlab-ci.yml]
search = cmake-{current_version}-linux 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 - apt-get update && apt-get install -y make cmake libboost-dev git
# We will install latest CMake, even though Ubuntu has a recent one # We will install latest CMake, even though Ubuntu has a recent one
- mkdir -p $HOME/.local - mkdir -p $HOME/.local
- curl -s "https://cmake.org/files/v3.22/cmake-3.22.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local - curl -s "https://cmake.org/files/v3.23/cmake-3.23.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

View File

@ -7,7 +7,7 @@ Certainly there are no shortage of problems when building.
But I think that, in 2022, we have a very good solution to quite a few of those problems. But I think that, in 2022, 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.4+, maybe even CMake 3.22+! I'm talking about Modern CMake. CMake 3.4+, maybe even CMake 3.23+!
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

@ -36,7 +36,7 @@ Windows users, who also 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.7...3.22) cmake_minimum_required(VERSION 3.7...3.23)
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})
@ -56,10 +56,10 @@ you will want to do this instead:
```cmake ```cmake
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.7)
if(${CMAKE_VERSION} VERSION_LESS 3.22) if(${CMAKE_VERSION} VERSION_LESS 3.23)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else() else()
cmake_policy(VERSION 3.22) cmake_policy(VERSION 3.23)
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 3.22+ 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.23+ support...
#### Quick list (more info on each method below) #### 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]: 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.22/cmake-3.22.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local ~ $ wget -qO- "https://cmake.org/files/v3.23/cmake-3.23.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local
{% endterm %} {% endterm %}
The names changed in 3.22; 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.23; 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 %} {% term %}
~ $ mkdir -p cmake-3.22 && wget -qO- "https://cmake.org/files/v3.22/cmake-3.22.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.22 ~ $ mkdir -p cmake-3.23 && wget -qO- "https://cmake.org/files/v3.23/cmake-3.23.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.23
~ $ export PATH=`pwd`/cmake-3.22/bin:$PATH ~ $ export PATH=`pwd`/cmake-3.23/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.
@ -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. 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.22/cmake-3.22.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local docker $ wget -qO- "https://cmake.org/files/v3.23/cmake-3.23.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local
{% endterm %} {% endterm %}
@ -131,8 +131,8 @@ Just `pip install cmake` on many systems. Add `--user` if you have to (modern pi
|---------------|---------------|-------| |---------------|---------------|-------|
| [TravisCI Xenial](https://docs.travis-ci.com/user/reference/xenial/#compilers-and-build-toolchain) | 3.12.4 | Mid November 2018 this image became ready for widescale use. | | [TravisCI Xenial](https://docs.travis-ci.com/user/reference/xenial/#compilers-and-build-toolchain) | 3.12.4 | Mid November 2018 this image became ready for widescale use. |
| [TravisCI Bionic](https://docs.travis-ci.com/user/reference/bionic/#compilers-and-build-toolchain) | 3.12.4 | Same as Xenial at the moment. | | [TravisCI Bionic](https://docs.travis-ci.com/user/reference/bionic/#compilers-and-build-toolchain) | 3.12.4 | Same as Xenial at the moment. |
| [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent) | 3.22.3 | kept up to date | | [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent) | 3.23.3 | kept up to date |
| [GitHub Actions 20.04](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md) | 3.22.3 | Same runners as Azure DevOps | | [GitHub Actions 20.04](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md) | 3.23.3 | Same runners as Azure DevOps |
If you are using GitHub Actions, also see the [jwlawson/actions-setup-cmake](https://github.com/marketplace/actions/actions-setup-cmake) action, which can install your selection of CMake, even in a docker action run. If you are using GitHub Actions, also see the [jwlawson/actions-setup-cmake](https://github.com/marketplace/actions/actions-setup-cmake) action, which can install your selection of CMake, even in a docker action run.

View File

@ -367,6 +367,31 @@ information.
* CTest can now modify environment variables * CTest can now modify environment variables
* Some generators now use external (system) markers on includes for MSVC * Some generators now use external (system) markers on includes for MSVC
## [CMake 3.23][]: Header only libraries
A solid release focused on header only libraries, more user control, CMake
presets, and better CUDA support. There are some powerful new features for
header only libraries, like the various `*_SETS` target properties. There are
new controls like the ability to restrict paths for `find_` commands and the
ability to remove `SYSTEM` from an existing target. You also get expanded
debugging features, and the ability to force all links to be to targets.
Presets can include other files. CUDA and C# received new updates, and a
couple of compilers were added.
* Initially released [March 29, 2022](https://blog.kitware.com/cmake-3-23-0-available-for-download/)
* CMake presets are a bit nicer, with the ability to include other files.
* A couple of new supported compilers, and better C# support.
* `FILE_SET` for `install` and `target_sources` header-only source files.
* `<INTERFACE_>HEADER_SETS`, `<INTERFACE_>HEADER_DIRS` for target headers.
* `CUDA_ARCHITECTURES` support for all and all-major.a
* DEBUG messages from can be enabled for `find_*` or find modules.
* `define_property()` has a handy `INITIALIZE_FROM_VARIABLE` option.
* `CMAKE_<SYSTEM_>IGNORE_PREFIX_PATH` to control `find_*` commands.
* `<CMAKE_>LINK_LIBRARIES_ONLY_TARGETS` added to force only targets linked
(nice for finding mistakes!).
* `IMPORTED_NO_SYSTEM`, a new property to forcibly remove SYSTEM from a target.
* `FindGTest` now adds a `GMock` target if found.
[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
[CMake 3.1]: https://cmake.org/cmake/help/latest/release/3.1.html [CMake 3.1]: https://cmake.org/cmake/help/latest/release/3.1.html
@ -391,6 +416,7 @@ information.
[CMake 3.20]: https://cmake.org/cmake/help/latest/release/3.20.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 3.21]: https://cmake.org/cmake/help/latest/release/3.21.html
[CMake 3.22]: https://cmake.org/cmake/help/latest/release/3.22.html [CMake 3.22]: https://cmake.org/cmake/help/latest/release/3.22.html
[CMake 3.23]: https://cmake.org/cmake/help/latest/release/3.23.html
[CMake master]: https://cmake.org/cmake/help/git-master/release/index.html [CMake master]: https://cmake.org/cmake/help/git-master/release/index.html
[fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/ [fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/

View File

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

View File

@ -1,5 +1,5 @@
# Works with 3.11 and tested through 3.22 # Works with 3.11 and tested through 3.23
cmake_minimum_required(VERSION 3.11...3.22) cmake_minimum_required(VERSION 3.11...3.23)
# 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( project(

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,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.22) cmake_minimum_required(VERSION 3.1...3.23)
# 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