From 43b34728e1606002523d81fdaa4ed6b82cc4bed7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 2 Jun 2022 14:30:14 -0400 Subject: [PATCH] style: run pre-commit --- README.md | 52 +- SUMMARY.md | 81 +- book.json | 66 +- chapters/basics.md | 13 +- chapters/basics/comms.md | 1 + chapters/basics/example.md | 2 +- chapters/basics/functions.md | 14 +- chapters/basics/structure.md | 6 +- chapters/basics/variables.md | 9 +- chapters/features.md | 1 - chapters/features/cpp11.md | 6 +- chapters/features/debug.md | 2 - chapters/features/ides.md | 3 - chapters/features/modules.md | 2 - chapters/features/small.md | 4 +- chapters/features/utilities.md | 13 +- chapters/install.md | 1 - chapters/install/installing.md | 1 - chapters/intro/dodonot.md | 59 +- chapters/intro/installing.md | 93 +- chapters/intro/newcmake.md | 527 +- chapters/intro/running.md | 18 +- chapters/packages/Boost.md | 8 +- chapters/packages/CUDA.md | 17 +- chapters/packages/MPI.md | 5 - chapters/packages/Minuit2.md | 5 +- chapters/packages/OpenMP.md | 4 +- chapters/packages/ROOT.md | 62 +- chapters/projects/download.md | 1 - chapters/projects/fetch.md | 8 +- chapters/projects/submodule.md | 1 - chapters/testing.md | 7 +- chapters/testing/catch.md | 4 +- chapters/testing/googletest.md | 14 +- examples/extended-project/README.md | 10 +- examples/extended-project/docs/mainpage.md | 2 +- examples/root-dict/README.md | 5 + examples/root-simple/README.md | 1 + examples/root-usefile/README.md | 1 + package-lock.json | 8030 ++++++++++---------- 40 files changed, 4569 insertions(+), 4590 deletions(-) diff --git a/README.md b/README.md index 03891a5..7f861bc 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,15 @@ And CMake 3.11+ is supposed to be significantly faster, as well! 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! [skprop]: https://iscinumpy.gitlab.io/post/scikit-build-proposal/ -{% endhint %} +{% endhint %} {% hint style='working' %} This book is meant to be a living document. You can raise an issue or put in a merge request on [GitLab](https://gitlab.com/CLIUtils/modern-cmake). You can also [download a copy as a PDF](https://CLIUtils.gitlab.io/modern-cmake/modern-cmake.pdf). Be sure to check the [HSF CMake Training][], as well! -[HSF CMake Training]: https://hsf-training.github.io/hsf-training-cmake-webpage/01-intro/index.html +[hsf cmake training]: https://hsf-training.github.io/hsf-training-cmake-webpage/01-intro/index.html + {% endhint %} In short, here are the most likely questions in your mind if you are considering Modern CMake: @@ -31,16 +32,16 @@ In short, here are the most likely questions in your mind if you are considering Do any of the following apply to you? -* You want to avoid hard-coding paths -* You need to build a package on more than one computer -* You want to use CI (continuous integration) -* You need to support different OSs (maybe even just flavors of Unix) -* You want to support multiple compilers -* You want to use an IDE, but maybe not all of the time -* You want to describe how your program is structured logically, not flags and commands -* You want to use a library -* You want to use tools, like Clang-Tidy, to help you code -* You want to use a debugger +- You want to avoid hard-coding paths +- You need to build a package on more than one computer +- You want to use CI (continuous integration) +- You need to support different OSs (maybe even just flavors of Unix) +- You want to support multiple compilers +- You want to use an IDE, but maybe not all of the time +- You want to describe how your program is structured logically, not flags and commands +- You want to use a library +- You want to use tools, like Clang-Tidy, to help you code +- You want to use a debugger If so, you'll benefit from a CMake-like build system. @@ -55,7 +56,6 @@ So, if you use a library that is designed to be included in your code, you have And that will quickly be the common denominator if you include multiple projects. And, if you need a library that's preinstalled, the chances of it having a find CMake script or config CMake script are excellent. - ## Why use a Modern CMake? Around CMake 2.6-2.8, CMake started taking over. It was in most of the package managers for Linux OS's, and was being used in lots of packages. @@ -72,9 +72,9 @@ I believe that CMake 3 had the bad luck to follow Python 3.[^1] Even though every version of CMake is insanely backward compatible, the 3 series was treated as if it were something new. And so, you'll find OSs like CentOS7 with GCC 4.8, with almost-complete C++14 support, and CMake 2.8, which came out years before C++11. -You really should *at least* use a version of CMake that came out after your compiler, since it needs to know compiler flags, etc, for that version. +You really should _at least_ use a version of CMake that came out after your compiler, since it needs to know compiler flags, etc, for that version. And, since CMake will dumb itself down to the minimum required version in your CMake file, installing a new CMake, even system wide, is pretty safe. -You should *at least* install it locally. +You should _at least_ install it locally. It's easy (1-2 lines in many cases), and you'll find that 5 minutes of work will save you hundreds of lines and hours of `CMakeLists.txt` writing, and will be much easier to maintain in the long run. This book tries to solve the problem of the poor examples and best practices that you'll find proliferating the web. @@ -83,24 +83,24 @@ This book tries to solve the problem of the poor examples and best practices tha Other material from the original author of this book: -* [HSF CMake Training][] -* [Interactive Modern CMake talks](https://gitlab.com/CLIUtils/modern-cmake-interactive-talk) +- [HSF CMake Training][] +- [Interactive Modern CMake talks](https://gitlab.com/CLIUtils/modern-cmake-interactive-talk) There are some other places to find good information on the web. Here are some of them: -* [The official help](https://cmake.org/cmake/help/latest/): Really amazing documentation. Nicely organized, great search, and you can toggle versions at the top. It just doesn't have a great "best practices tutorial", which is what this book tries to fill in. -* [Effective Modern CMake](https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1): A great list of do's and don'ts. -* [Embracing Modern CMake](https://steveire.wordpress.com/2017/11/05/embracing-modern-cmake/): A post with good description of the term -* [It's time to do CMake Right](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/): A nice set of best practices for Modern CMake projects. -* [The Ultimate Guide to Modern CMake](https://rix0r.nl/blog/2015/08/13/cmake-guide/): A slightly dated post with similar intent. -* [More Modern CMake](https://youtu.be/y7ndUhdQuU8): A great presentation from Meeting C++ 2018 that recommends CMake 3.12+. This talk makes calls CMake 3.0+ "Modern CMake" and CMake 3.12+ "More Modern CMake". -* [Oh No! More Modern CMake](https://www.youtube.com/watch?v=y9kSr5enrSk): The sequel to More Modern CMake. -* [toeb/moderncmake](https://github.com/toeb/moderncmake): A nice presentation and examples about CMake 3.5+, with intro to syntax through project organization +- [The official help](https://cmake.org/cmake/help/latest/): Really amazing documentation. Nicely organized, great search, and you can toggle versions at the top. It just doesn't have a great "best practices tutorial", which is what this book tries to fill in. +- [Effective Modern CMake](https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1): A great list of do's and don'ts. +- [Embracing Modern CMake](https://steveire.wordpress.com/2017/11/05/embracing-modern-cmake/): A post with good description of the term +- [It's time to do CMake Right](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/): A nice set of best practices for Modern CMake projects. +- [The Ultimate Guide to Modern CMake](https://rix0r.nl/blog/2015/08/13/cmake-guide/): A slightly dated post with similar intent. +- [More Modern CMake](https://youtu.be/y7ndUhdQuU8): A great presentation from Meeting C++ 2018 that recommends CMake 3.12+. This talk makes calls CMake 3.0+ "Modern CMake" and CMake 3.12+ "More Modern CMake". +- [Oh No! More Modern CMake](https://www.youtube.com/watch?v=y9kSr5enrSk): The sequel to More Modern CMake. +- [toeb/moderncmake](https://github.com/toeb/moderncmake): A nice presentation and examples about CMake 3.5+, with intro to syntax through project organization ## Credits Modern CMake was originally written by [Henry Schreiner](https://iscinumpy.gitlab.io). Other contributors can be found [listed on GitLab](https://gitlab.com/CLIUtils/modern-cmake/-/network/master). -[HSF CMake Training]: https://hsf-training.github.io/hsf-training-cmake-webpage/01-intro/index.html +[hsf cmake training]: https://hsf-training.github.io/hsf-training-cmake-webpage/01-intro/index.html [^1]: CMake 3.0 also removed several long deprecated features from very old versions of CMake and make one very tiny backwards incompatible change to syntax related to square brackets, so this is not entirely fair; there might be some very, very old CMake files that would stop working with 3. I've never seen one, though. diff --git a/SUMMARY.md b/SUMMARY.md index 6fd95fa..0039943 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -1,46 +1,45 @@ # Summary -* [An Introduction to Modern CMake](README.md) - * [Installing CMake](chapters/intro/installing.md) - * [Running CMake](chapters/intro/running.md) - * [Do's and Don'ts](chapters/intro/dodonot.md) - * [What's new in CMake](chapters/intro/newcmake.md) -* [Introduction to the Basics](chapters/basics.md) - * [Variables and the Cache](chapters/basics/variables.md) - * [Programming in CMake](chapters/basics/functions.md) - * [Communicating with your code](chapters/basics/comms.md) - * [How to Structure Your Project](chapters/basics/structure.md) - * [Running Other Programs](chapters/basics/programs.md) - * [A Simple Example](chapters/basics/example.md) -* [Adding Features](chapters/features.md) - * [C++11 and Beyond](chapters/features/cpp11.md) - * [Small but common needs](chapters/features/small.md) - * [Utilities](chapters/features/utilities.md) - * [Useful modules](chapters/features/modules.md) - * [IDEs](chapters/features/ides.md) - * [Debugging](chapters/features/debug.md) -* [Including Projects](chapters/projects.md) - * [Submodule](chapters/projects/submodule.md) - * [DownloadProject](chapters/projects/download.md) - * [Fetch (CMake 3.11)](chapters/projects/fetch.md) -* [Testing](chapters/testing.md) - * [GoogleTest](chapters/testing/googletest.md) - * [Catch](chapters/testing/catch.md) -* [Exporting and Installing](chapters/install.md) - * [Installing](chapters/install/installing.md) - * [Exporting](chapters/install/exporting.md) - * [Packaging](chapters/install/packaging.md) -* [Looking for Libraries (Packages)](chapters/packages.md) - * [CUDA](chapters/packages/CUDA.md) - * [OpenMP](chapters/packages/OpenMP.md) - * [Boost](chapters/packages/Boost.md) - * [MPI](chapters/packages/MPI.md) - * [ROOT](chapters/packages/ROOT.md) - * [UseFile Example](examples/root-usefile/README.md) - * [Simple Example](examples/root-simple/README.md) - * [Dictionary Example](examples/root-dict/README.md) - * [Minuit2](chapters/packages/Minuit2.md) - +- [An Introduction to Modern CMake](README.md) + - [Installing CMake](chapters/intro/installing.md) + - [Running CMake](chapters/intro/running.md) + - [Do's and Don'ts](chapters/intro/dodonot.md) + - [What's new in CMake](chapters/intro/newcmake.md) +- [Introduction to the Basics](chapters/basics.md) + - [Variables and the Cache](chapters/basics/variables.md) + - [Programming in CMake](chapters/basics/functions.md) + - [Communicating with your code](chapters/basics/comms.md) + - [How to Structure Your Project](chapters/basics/structure.md) + - [Running Other Programs](chapters/basics/programs.md) + - [A Simple Example](chapters/basics/example.md) +- [Adding Features](chapters/features.md) + - [C++11 and Beyond](chapters/features/cpp11.md) + - [Small but common needs](chapters/features/small.md) + - [Utilities](chapters/features/utilities.md) + - [Useful modules](chapters/features/modules.md) + - [IDEs](chapters/features/ides.md) + - [Debugging](chapters/features/debug.md) +- [Including Projects](chapters/projects.md) + - [Submodule](chapters/projects/submodule.md) + - [DownloadProject](chapters/projects/download.md) + - [Fetch (CMake 3.11)](chapters/projects/fetch.md) +- [Testing](chapters/testing.md) + - [GoogleTest](chapters/testing/googletest.md) + - [Catch](chapters/testing/catch.md) +- [Exporting and Installing](chapters/install.md) + - [Installing](chapters/install/installing.md) + - [Exporting](chapters/install/exporting.md) + - [Packaging](chapters/install/packaging.md) +- [Looking for Libraries (Packages)](chapters/packages.md) + - [CUDA](chapters/packages/CUDA.md) + - [OpenMP](chapters/packages/OpenMP.md) + - [Boost](chapters/packages/Boost.md) + - [MPI](chapters/packages/MPI.md) + - [ROOT](chapters/packages/ROOT.md) + - [UseFile Example](examples/root-usefile/README.md) + - [Simple Example](examples/root-simple/README.md) + - [Dictionary Example](examples/root-dict/README.md) + - [Minuit2](chapters/packages/Minuit2.md)