diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 632ce73..8a00ccd 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.26.0 +current_version = 3.27.0 [bumpversion:file:.gitlab-ci.yml] search = cmake-{current_version}-linux diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41a78d8..96b79ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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.26/cmake-3.26.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local + - curl -s "https://cmake.org/files/v3.27/cmake-3.27.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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff14706..9c18511 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,13 +21,13 @@ repos: additional_dependencies: [pyyaml] - repo: https://github.com/codespell-project/codespell - rev: "v2.2.4" + rev: "v2.2.5" hooks: - id: codespell args: ["-L", "ba"] - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.0-alpha.6" + rev: "v3.0.0" hooks: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json] diff --git a/README.md b/README.md index cf94d39..397045c 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,15 @@ People love to hate build systems. Just watch the talks from CppCon17 to see examples of developers making the state of build systems the brunt of jokes. This raises the question: Why? 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 2023, 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.26+! +I'm talking about Modern CMake. CMake 3.5+, maybe even CMake 3.27+! 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! {% hint %} -Are you interested in using CMake to build Python packages? Read about a [proposal to work on Scikit-build here][skprop], and let me know if you have a science use case! +Are you interested in using CMake to build Python packages? I'm working on scikit-build-core, [proposal described here][skprop]! Let me know if you have a use case! [skprop]: https://iscinumpy.gitlab.io/post/scikit-build-proposal/ diff --git a/chapters/basics.md b/chapters/basics.md index 460ab42..e7aefae 100644 --- a/chapters/basics.md +++ b/chapters/basics.md @@ -34,7 +34,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.26) +cmake_minimum_required(VERSION 3.7...3.27) if(${CMAKE_VERSION} VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) @@ -54,10 +54,10 @@ you will want to do this instead: ```cmake cmake_minimum_required(VERSION 3.7) -if(${CMAKE_VERSION} VERSION_LESS 3.26) +if(${CMAKE_VERSION} VERSION_LESS 3.27) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) else() - cmake_policy(VERSION 3.26) + cmake_policy(VERSION 3.27) endif() ``` diff --git a/chapters/install/installing.md b/chapters/install/installing.md index 805cbbf..24b61c8 100644 --- a/chapters/install/installing.md +++ b/chapters/install/installing.md @@ -71,5 +71,6 @@ When CMake searches for a package, it will look in the current install prefix an The [CMakePackageConfigHelpers](https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html) module mentioned above has additional tools to help write a more relocatable `Config.cmake` file. Refer to the CMake documentation on [configure_package_config_file](https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#command:configure_package_config_file) (used instead of `configure_file`) and the `@PACKAGE_INIT@` substitution string to get -* a set of automatically defined `PACKAGE_` variables (for relative path versions of ``) and -* a `set_and_check()` alternative to `set()` to automatically check for path existence. + +- a set of automatically defined `PACKAGE_` variables (for relative path versions of ``) and +- a `set_and_check()` alternative to `set()` to automatically check for path existence. diff --git a/chapters/intro/installing.md b/chapters/intro/installing.md index 5fbbf57..336bc9a 100644 --- a/chapters/intro/installing.md +++ b/chapters/intro/installing.md @@ -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.26+ 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.27+ support... #### Quick list (more info on each method below) @@ -35,14 +35,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/Ubuntu 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.26/cmake-3.26.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local +~ $ wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.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: {% term %} -~ $ mkdir -p cmake-3.26 && wget -qO- "https://cmake.org/files/v3.26/cmake-3.26.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.26 -~ $ export PATH=`pwd`/cmake-3.26/bin:$PATH +~ $ mkdir -p cmake-3.27 && wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.27 +~ $ export PATH=`pwd`/cmake-3.27/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. @@ -50,7 +50,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.26/cmake-3.26.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local +docker $ wget -qO- "https://cmake.org/files/v3.27/cmake-3.27.0-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local {% endterm %} If you are on a system without wget, replace `wget -qO-` with `curl -s`. @@ -132,8 +132,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 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.26.0 | kept up to date | -| [GitHub Actions 20.04](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md) | 3.26.0 | Same runners as Azure DevOps | +| [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#use-a-microsoft-hosted-agent) | 3.27.0 | kept up to date | +| [GitHub Actions 20.04](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md) | 3.27.0 | 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. diff --git a/chapters/intro/newcmake.md b/chapters/intro/newcmake.md index 49be35d..724e887 100644 --- a/chapters/intro/newcmake.md +++ b/chapters/intro/newcmake.md @@ -4,8 +4,29 @@ This is an abbreviated version of the CMake changelog with just the highlights f ## [CMake in development][cmake master]: WIP -- FindCUDA fully deprecated, use CUDA language and FindCUDAToolkit -- C++ Modules extensions (`.ccm`, `.cxxm``, `.c++m`) are treated as C++ +* `CMAKE_CROSSCOMPILING_EMULATOR` environment variable added. +* Apple's VisionOS added. + + +## [CMake 3.27][]: Debugger + +This release adds the new CMake debugger! This should improve support for +debugging your CMake code in something like VSCode. This release also +"removes" FindPythonLibs/FindPythonInterp/FindCUDA; if the min or max version +is set to 3.27 or higher, the modules will be missing. + +- Initially released [July 19, 2023](https://www.kitware.com/cmake-3-27-0-available-for-download/) +- C++ Modules extensions (`.ccm`, `.cxxm`, `.c++m`) are treated as C++ +- `COMPILE_ONLY`, `LIST`, and `PATH` generator expressions added, along with a few more specific ones. +- New `SKIP_LINTING`, as well as more generator expression support in things like `_CPPCHECK`, etc. +- `find_package` now searches for uppercase `_ROOT` CMake/Environment variables. +- Added `add_custom_command(... DEPENDS_EXPLICIT_ONLY` & variable for Ninja dependency control. +- CMake build verbose now prints the working dir and command line used to build. +- Better support for versions of MSVC. +- Several new CUDA properties related to targeting .`cubin`/`.fatbin`/`.optixir`. +- Setting `cmake_minimum_required` less than 3.5 is now deprecated. +- FindCUDA simi-removed, use CUDA language and FindCUDAToolkit. +- FindPythonLibs & FindPythonInterp simi-removed, use FindPython. ## [CMake 3.26][]: Logging & Python @@ -475,5 +496,6 @@ There were a ton of additions to this version of CMake, primarily to fill out th [cmake 3.24]: https://cmake.org/cmake/help/latest/release/3.24.html [cmake 3.25]: https://cmake.org/cmake/help/latest/release/3.25.html [cmake 3.26]: https://cmake.org/cmake/help/latest/release/3.26.html +[cmake 3.27]: https://cmake.org/cmake/help/latest/release/3.27.html [cmake master]: https://cmake.org/cmake/help/git-master/release/index.html [fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 848e80a..8197abd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11...3.26) +cmake_minimum_required(VERSION 3.11...3.27) project(ModernCMakeExamples) set(MODERN_CMAKE_BUILD_TESTING ON) diff --git a/examples/extended-project/CMakeLists.txt b/examples/extended-project/CMakeLists.txt index 7a39c84..d49dac6 100644 --- a/examples/extended-project/CMakeLists.txt +++ b/examples/extended-project/CMakeLists.txt @@ -1,5 +1,5 @@ -# Works with 3.14 and tested through 3.26 -cmake_minimum_required(VERSION 3.14...3.26) +# Works with 3.14 and tested through 3.27 +cmake_minimum_required(VERSION 3.14...3.27) # Project name and a few useful settings. Other commands can pick up the results project( diff --git a/examples/fetch/CMakeLists.txt b/examples/fetch/CMakeLists.txt index f9e8122..f85779c 100644 --- a/examples/fetch/CMakeLists.txt +++ b/examples/fetch/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14...3.26) +cmake_minimum_required(VERSION 3.14...3.27) project(FetchExample LANGUAGES CXX) diff --git a/examples/root-dict/CMakeLists.txt b/examples/root-dict/CMakeLists.txt index 387fea3..bd31ca0 100644 --- a/examples/root-dict/CMakeLists.txt +++ b/examples/root-dict/CMakeLists.txt @@ -2,7 +2,7 @@ ## [main] -cmake_minimum_required(VERSION 3.4...3.26) +cmake_minimum_required(VERSION 3.4...3.27) project(RootDictExample LANGUAGES CXX) diff --git a/examples/root-simple/CMakeLists.txt b/examples/root-simple/CMakeLists.txt index f08ffbc..32e1018 100644 --- a/examples/root-simple/CMakeLists.txt +++ b/examples/root-simple/CMakeLists.txt @@ -1,7 +1,7 @@ # CMake ROOT simple example ## [main] -cmake_minimum_required(VERSION 3.1...3.26) +cmake_minimum_required(VERSION 3.1...3.27) project(RootSimpleExample LANGUAGES CXX) diff --git a/examples/root-usefile/CMakeLists.txt b/examples/root-usefile/CMakeLists.txt index 6595d5e..dc255cd 100644 --- a/examples/root-usefile/CMakeLists.txt +++ b/examples/root-usefile/CMakeLists.txt @@ -1,7 +1,7 @@ # CMake ROOT usefile example ## [main] -cmake_minimum_required(VERSION 3.1...3.26) +cmake_minimum_required(VERSION 3.1...3.27) project(RootUseFileExample LANGUAGES CXX) diff --git a/examples/simple-project/CMakeLists.txt b/examples/simple-project/CMakeLists.txt index 76cd014..1fe3ba3 100644 --- a/examples/simple-project/CMakeLists.txt +++ b/examples/simple-project/CMakeLists.txt @@ -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.26) +cmake_minimum_required(VERSION 3.1...3.27) # This is your project statement. You should always list languages; # Listing the version is nice here since it sets lots of useful variables