From d68fed4381757c7cfb0eaaa1d1c0548c1054fb88 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 11 Feb 2021 10:59:19 -0500 Subject: [PATCH 1/3] chore: bumpversion patch 1.19.4 --- .bumpversion.cfg | 2 +- .gitlab-ci.yml | 2 +- chapters/intro/installing.md | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f8c7eeb..4b7b88e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.19.0 +current_version = 3.19.4 [bumpversion:file:.gitlab-ci.yml] search = cmake-{current_version}-Linux diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f58d993..a3e4001 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.19/cmake-3.19.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local + - curl -s "https://cmake.org/files/v3.19/cmake-3.19.4-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/chapters/intro/installing.md b/chapters/intro/installing.md index 5c731c0..3e68c77 100644 --- a/chapters/intro/installing.md +++ b/chapters/intro/installing.md @@ -34,13 +34,13 @@ 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.19/cmake-3.19.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local +~ $ wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local {% endterm %} If you just want a local folder with CMake only: {% term %} -~ $ mkdir -p cmake-3.19 && wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.19 +~ $ mkdir -p cmake-3.19 && wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.19 ~ $ export PATH=`pwd`/cmake-3.19/bin:$PATH {% endterm %} @@ -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.19/cmake-3.19.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local +docker $ wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local {% endterm %} From ce901a900b586eebd960ff9e51ba9f73e5260037 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 11 Feb 2021 11:01:48 -0500 Subject: [PATCH 2/3] fix: mention Apple Silicon --- chapters/intro/installing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapters/intro/installing.md b/chapters/intro/installing.md index 3e68c77..ed35691 100644 --- a/chapters/intro/installing.md +++ b/chapters/intro/installing.md @@ -29,7 +29,7 @@ Ordered by author preference: ## Official package -You can [download CMake from KitWare][download]. This is how you will probably get CMake if you are on Windows. It's not a bad way to get it on macOS either, but using `brew install cmake` is much nicer if you use [Homebrew](https://brew.sh) (and you should). You can also get it on most other package managers, such as [Chocolatey](https://chocolatey.org) for Windows or [MacPorts](https://www.macports.org) for macOS. +You can [download CMake from KitWare][download]. This is how you will probably get CMake if you are on Windows. It's not a bad way to get it on macOS either (and a Universal2 version is supplied supporting both Intel and Apple Silicon), but using `brew install cmake` is much nicer if you use [Homebrew](https://brew.sh) (and you should; Apple even supports Homebrew such as during the Apple Silicon rollout). You can also get it on most other package managers, such as [Chocolatey](https://chocolatey.org) for Windows or [MacPorts](https://www.macports.org) for macOS. 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]: @@ -117,7 +117,7 @@ You should only use the default CMake on 18.04+; it's an LTS release with a pret [![Conda-forge](https://img.shields.io/conda/vn/conda-forge/cmake.svg)][Conda-Forge] [![Anaconda](https://anaconda.org/anaconda/cmake/badges/version.svg?style=flat)][Anaconda] -Just `pip install cmake` on many systems. Add `--user` if you have to (modern pip does this for you if needed). +Just `pip install cmake` on many systems. Add `--user` if you have to (modern pip does this for you if needed). This does not supply Universal2 wheels yet. ### CI From 83611f1557f1d9e1710f03518a04f69d28fd93dd Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 11 Feb 2021 11:05:55 -0500 Subject: [PATCH 3/3] fix: make sure CMAKE_CXX_STANDARD is set as cached --- chapters/features/cpp11.md | 6 +++--- examples/root-dict/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chapters/features/cpp11.md b/chapters/features/cpp11.md index 4da2a4a..a7525e4 100644 --- a/chapters/features/cpp11.md +++ b/chapters/features/cpp11.md @@ -32,12 +32,12 @@ A related feature, [`WriteCompilerDetectionHeader`](https://cmake.org/cmake/help There is another way that C++ standards are supported; a specific set of three properties (both global and target level). The global properties are: ```cmake -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) ``` -The first line sets a C++ standard level, and the second tells CMake to use it, and the final line is optional and ensures `-std=c++11` vs. something like `-std=g++11`. This method isn't bad for a final package, but shouldn't be used by a library. You can also set these values on a target: +The first line sets a C++ standard level, and the second tells CMake to use it, and the final line is optional and ensures `-std=c++11` vs. something like `-std=g++11`. This method isn't bad for a final package, but shouldn't be used by a library. You should always set this as a cached variable, so you can override it to try a new version easily (or if this gets used as a library, this is the only way to override it - but again, don't use this for libraries). You can also set these values on a target: ```cmake set_target_properties(myTarget PROPERTIES @@ -47,7 +47,7 @@ set_target_properties(myTarget PROPERTIES ) ``` -Which is better, but still doesn't have the sort of explicit control that compiler features have for populating `PRIVATE` and `INTERFACE` properties. +Which is better, but still doesn't have the sort of explicit control that compiler features have for populating `PRIVATE` and `INTERFACE` properties, so it really is only useful on final targets. You can find more information about the final two methods on [Craig Scott's useful blog post][crascit]. diff --git a/examples/root-dict/CMakeLists.txt b/examples/root-dict/CMakeLists.txt index 899a8f4..8dca522 100644 --- a/examples/root-dict/CMakeLists.txt +++ b/examples/root-dict/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.4...3.19) project(RootDictExample LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) +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)