From f2e36349bf5b8ec758b0a0bc4a96410e2a9fd66c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 2 Jun 2022 14:04:47 -0400 Subject: [PATCH] fix: minor cleanups Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 3 ++- chapters/intro/installing.md | 10 +++++----- chapters/intro/newcmake.md | 27 +++++++++++++++++++++++++-- chapters/packages/ROOT.md | 8 ++++---- examples/root-dict/CMakeLists.txt | 4 +++- 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62866c9..3518c58 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.2.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -9,6 +9,7 @@ repos: - id: check-yaml - id: debug-statements - id: end-of-file-fixer + exclude: \.cmake$ - id: mixed-line-ending - id: requirements-txt-fixer - id: trailing-whitespace diff --git a/chapters/intro/installing.md b/chapters/intro/installing.md index 855a77c..3913ccc 100644 --- a/chapters/intro/installing.md +++ b/chapters/intro/installing.md @@ -38,7 +38,7 @@ On Linux, there are several options. Kitware provides a [Debian/Ubunutu apt repo ~ $ wget -qO- "https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local {% endterm %} -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: +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.23 && wget -qO- "https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.23 @@ -101,10 +101,10 @@ You should only use the default CMake on 18.04+; it's an LTS release with a pret #### Debian -[![Debian 10 package](https://repology.org/badge/version-for-repo/debian_10/cmake.svg)][repology] -[![Debian 10 backports package](https://repology.org/badge/version-for-repo/debian_10_backports/cmake.svg)][repology] -[![Debian 11 package](https://repology.org/badge/version-for-repo/debian_11/cmake.svg)][repology] -[![Debian 11 backports package](https://repology.org/badge/version-for-repo/debian_11_backports/cmake.svg)][repology] +[![Debian 10 package](https://repology.org/badge/version-for-repo/debian_10/cmake.svg)][repology] +[![Debian 10 backports package](https://repology.org/badge/version-for-repo/debian_10_backports/cmake.svg)][repology] +[![Debian 11 package](https://repology.org/badge/version-for-repo/debian_11/cmake.svg)][repology] +[![Debian 11 backports package](https://repology.org/badge/version-for-repo/debian_11_backports/cmake.svg)][repology] [![Debian Unstable package](https://repology.org/badge/version-for-repo/debian_unstable/cmake.svg)][repology] #### Other diff --git a/chapters/intro/newcmake.md b/chapters/intro/newcmake.md index b9182e6..c26a341 100644 --- a/chapters/intro/newcmake.md +++ b/chapters/intro/newcmake.md @@ -302,7 +302,7 @@ for permissions. Further support for generator expressions in more places. * `DIRECTORY` can now include a binary directory in property commands * New `JSON` commands for `string` * New `OPTIMIZE_DEPENDENCIES` property and `CMAKE_*` variable for smartly dropping dependencies of static and object libraries. -* PCH support expanded with `PCH_INSTANTIATE_TEMPLATES` property and `CMAKE_*` variable. +* PCH support expanded with `PCH_INSTANTIATE_TEMPLATES` property and `CMAKE_*` variable. * Check modules have been expanded with `CUDA` and `ISPC` languages * FindPython: `Python*_LINK_OPTIONS` added * `compute-sanitizer` for ctest now supports CUDA for memcheck @@ -392,6 +392,30 @@ couple of compilers were added. * `IMPORTED_NO_SYSTEM`, a new property to forcibly remove SYSTEM from a target. * `FindGTest` now adds a `GMock` target if found. + +## [CMake 3.24][CMake master]: WIP + +The next release is shaping up to be a fantastic release. Package writers are +getting integration between `find_package` and `FetchContent` that will allow +"download if missing" workflows, and is configurable by packagers. Similarly, +warnings as errors can be set by a package and removed by packagers, as well +(still make sure not to do this unless you are being build as the main +project!). + + +* `--fresh` option removes the old cache when running. +* `find_package` and `FetchContent` now have integration - you have options to download missing dependencies. +* `find_package` has a new `GLOBAL` option. +* `CMAKE_PROJECT_TOP_LEVEL_INCLUDES` allows a user (like packagers) to inject pre-project code. +* `PATH` management for generator expressions. +* `CMAKE_COLOR_DIAGNOSTICS` env var & variable added, replacing `CMAKE_COLOR_MAKEFILE`. +* You can disable `find_*` searching the install prefix. +* `COMPILE_WARNING_AS_ERROR` property and `CMAKE_` variable, and `--compile-no-warning-as-error` to disable it. +* CUDA supports `native` to compile for the current GPUs detected. +* `SYSTEM` includes now are respected on MSVC generators. +* Better support for MSVC, XCode, and others. +* `LLVMFlang` compiler support. + [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.1]: https://cmake.org/cmake/help/latest/release/3.1.html @@ -419,4 +443,3 @@ couple of compilers were added. [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 [fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/ - diff --git a/chapters/packages/ROOT.md b/chapters/packages/ROOT.md index b353455..0423a94 100644 --- a/chapters/packages/ROOT.md +++ b/chapters/packages/ROOT.md @@ -62,12 +62,12 @@ Dictionary generation is ROOT's way of working around the missing reflection fea * Your class definition should end with `ClassDef(MyClassName, 1)` * Your class implementation should have `ClassImp(MyClassName)` in it -ROOT provides `rootcling` and `genreflex` (a legacy interface to `rootcling`) binaries which produce the source files required to build the dictionary. It also defines `root_generate_dictionary`, a CMake function to invoke `rootcling` during the build process. +ROOT provides `rootcling` and `genreflex` (a legacy interface to `rootcling`) binaries which produce the source files required to build the dictionary. It also defines `root_generate_dictionary`, a CMake function to invoke `rootcling` during the build process. -To load this function, first include the ROOT macros: +To load this function, first include the ROOT macros: ```cmake include("${ROOT_DIR}/modules/RootNewMacros.cmake") -# For ROOT versions than 6.16, things break +# For ROOT versions than 6.16, things break # if nothing is in the global include list! if (${ROOT_VERSION} VERSION_LESS "6.16") include_directories(ROOT_NONEXISTENT_DIRECTORY_HACK) @@ -101,7 +101,7 @@ add_library(Example) root_generate_dictionary(G__Example Example.h MODULE Example LINKDEF ExampleLinkDef.h) ``` -The full name of the dictionary (e.g. `G__Example`) should not be identical to the `MODULE` argument. +The full name of the dictionary (e.g. `G__Example`) should not be identical to the `MODULE` argument. [linkdef-root]: https://root.cern.ch/selecting-dictionary-entries-linkdefh diff --git a/examples/root-dict/CMakeLists.txt b/examples/root-dict/CMakeLists.txt index 3cd0462..36b3d94 100644 --- a/examples/root-dict/CMakeLists.txt +++ b/examples/root-dict/CMakeLists.txt @@ -6,7 +6,9 @@ cmake_minimum_required(VERSION 3.4...3.23) project(RootDictExample LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use") +set(CMAKE_CXX_STANDARD + 11 + CACHE STRING "C++ standard to use") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_PLATFORM_INDEPENDENT_CODE ON)