diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3f24bb..531c68e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ test_code: - yum install -y make cmake boost-devel git # will install latest CMake, even though Fedora has a recent one - mkdir -p $HOME/.local - - curl -s "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C $HOME/.local + - curl -s "https://cmake.org/files/v3.16/cmake-3.16.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/README.md b/README.md index fb046be..bd4a3f6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Certainly there are no shortage of problems when building. But I think that, in 2018, 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.1+, maybe even CMake 3.15+! +I'm talking about Modern CMake. CMake 3.1+, maybe even CMake 3.16+! 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! diff --git a/chapters/intro/installing.md b/chapters/intro/installing.md index cea1f2a..c86412a 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 CMake < 3.15 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 CMake < 3.16 support... #### Quick list (more info on each method below) @@ -32,14 +32,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.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C ~/.local +~ $ wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-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.15 && wget -qO- "https://cmake.org/files/v3.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.15 -~ $ export PATH=`pwd`/cmake-3.15/bin:$PATH +~ $ mkdir -p cmake-3.16 && wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C cmake-3.16 +~ $ export PATH=`pwd`/cmake-3.16/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. @@ -47,7 +47,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.15/cmake-3.15.4-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local +docker $ wget -qO- "https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local {% endterm %} @@ -62,12 +62,14 @@ Here are some common build environments and the CMake version you'll find on the | Distribution | CMake version | Notes | |---------------|---------------|-------| | [RHEL/CentOS 7](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake) | 2.8.11 | Don't use the default on this system. Grab a new copy or use the EPEL repo. | +| [RHEL/CentOS 8](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake) | 3.11.4 | Not too bad. | | [EPEL for RHEL/CentOS](https://rpms.remirepo.net/rpmphp/zoom.php?rpm=cmake3) | 3.13.4 | Called `cmake3` | | [Ubuntu 14.04 LTS: Trusty](https://launchpad.net/ubuntu/trusty/+source/cmake) | 2.8.12 | Don't use the default on this system. | | [Ubuntu 16.04 LTS: Xenial](https://launchpad.net/ubuntu/xenial/+source/cmake) | 3.5.1 | | | [Ubuntu 18.04 LTS: Bionic](https://launchpad.net/ubuntu/bionic/+source/cmake) | 3.10.2 | An LTS with a pretty decent minimum version! | | [Ubuntu 18.10: Cosmic](https://launchpad.net/ubuntu/cosmic/+source/cmake) | 3.12.1 | | | [Ubuntu 19.04: Disco](https://launchpad.net/ubuntu/disco/+source/cmake) | 3.13.4 | | +| [Ubuntu 19.10: Eoan](https://launchpad.net/ubuntu/eoan/+source/cmake) | 3.13.4 | Oddly identical to Disco. | | [AlpineLinux 3.10](https://pkgs.alpinelinux.org/packages?name=cmake&branch=v3.10)| 3.14.5 | Useful in Docker | | [Python PyPI][PyPI] | 3.15.3 | Just `pip install cmake` on many systems. Add `--user` for local installs. (ManyLinux1 (old pip or OS) gets CMake 3.13.3)| | [Anaconda][] | 3.14.0 | For use with Conda | diff --git a/chapters/intro/newcmake.md b/chapters/intro/newcmake.md index 659fabd..9bd383d 100644 --- a/chapters/intro/newcmake.md +++ b/chapters/intro/newcmake.md @@ -207,10 +207,15 @@ module. `export(PACKAGE)` has drastically changed; it now no longer touches `$HO * Several Ninja improvements, include SWIFT language support * Compiler and list improvements to generator expressions -## [CMake 3.16][] : IN DEVELOPMENT +## [CMake 3.16][] : Unity builds +A new unity build mode was added, allowing source files to be merged into a single build file. Support for +precompiled headers (possibly preparing for C++20 modules, perhaps?) was added. Lots of other smaller +fixes were implemented, especially to newer features, such as to FindPython, FindDoxygen, and others. + +* Added support for Objective C and Objective C++ languages * Support for precompiling headers, with `target_precompile_headers` -* Support for "Unity" or "Jumbo" builds (merging source files) with `CMAKE_UNITY_BUILD` +* Support for "Unity" or "Jumbo" builds (merging source files) with «variable:CMAKE_UNITY_BUILD» * CTest: Can now skip based on regex, expand lists * Several new features to control RPath. * Generator expressions work in more places, like build and install paths @@ -234,5 +239,5 @@ module. `export(PACKAGE)` has drastically changed; it now no longer touches `$HO [CMake 3.13]: https://cmake.org/cmake/help/latest/release/3.13.html [CMake 3.14]: https://cmake.org/cmake/help/latest/release/3.14.html [CMake 3.15]: https://cmake.org/cmake/help/latest/release/3.15.html -[CMake 3.16]: https://cmake.org/cmake/help/git-master/release/index.html +[CMake 3.16]: https://cmake.org/cmake/help/latest/release/3.16.html [fastercmake]: https://blog.kitware.com/improving-cmakes-runtime-performance/ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 3809818..c215994 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11...3.15) +cmake_minimum_required(VERSION 3.11...3.16) project(ModernCMakeExamples) set(MODERN_CMAKE_BUILD_TESTING ON) diff --git a/examples/extended-project/CMakeLists.txt b/examples/extended-project/CMakeLists.txt index 1afe08c..4fcfb0a 100644 --- a/examples/extended-project/CMakeLists.txt +++ b/examples/extended-project/CMakeLists.txt @@ -1,5 +1,5 @@ # Works with 3.11 and tested through 3.15 -cmake_minimum_required(VERSION 3.11...3.15) +cmake_minimum_required(VERSION 3.11...3.16) # Project name and a few useful settings. Other commands can pick up the results project(ModernCMakeExample diff --git a/examples/root-dict/CMakeLists.txt b/examples/root-dict/CMakeLists.txt index fe3ab82..5086326 100644 --- a/examples/root-dict/CMakeLists.txt +++ b/examples/root-dict/CMakeLists.txt @@ -1,6 +1,6 @@ ## [main] -cmake_minimum_required(VERSION 3.4...3.15) +cmake_minimum_required(VERSION 3.4...3.16) project(RootDictExample LANGUAGES CXX) diff --git a/examples/root-simple/CMakeLists.txt b/examples/root-simple/CMakeLists.txt index 1bae685..4203db7 100644 --- a/examples/root-simple/CMakeLists.txt +++ b/examples/root-simple/CMakeLists.txt @@ -1,6 +1,6 @@ ## [main] -cmake_minimum_required(VERSION 3.1...3.15) +cmake_minimum_required(VERSION 3.1...3.16) project(RootSimpleExample LANGUAGES CXX) diff --git a/examples/root-usefile/CMakeLists.txt b/examples/root-usefile/CMakeLists.txt index 3e2cf7b..7458ba1 100644 --- a/examples/root-usefile/CMakeLists.txt +++ b/examples/root-usefile/CMakeLists.txt @@ -1,6 +1,6 @@ ## [main] -cmake_minimum_required(VERSION 3.1...3.15) +cmake_minimum_required(VERSION 3.1...3.16) project(RootUseFileExample LANGUAGES CXX) diff --git a/examples/simple-project/CMakeLists.txt b/examples/simple-project/CMakeLists.txt index 97f6230..f9f6414 100644 --- a/examples/simple-project/CMakeLists.txt +++ b/examples/simple-project/CMakeLists.txt @@ -5,7 +5,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.15) +cmake_minimum_required(VERSION 3.1...3.16) # This is your project statement. You should always list languages; # Listing the version is nice here since it sets lots of useful variables