This is the code repository for CMake Cookbook, published by Packt.
Building, testing, and packaging modular software with modern CMake
CMake is cross-platform, open-source software for managing the build process in a portable fashion. This book features a collection of recipes and building blocks with tips and techniques for working with CMake, CTest, CPack, and CDash.
This book covers the following exciting features:
- Configure, build, test, and install code projects using CMake
- Detect operating systems, processors, libraries, files, and programs for conditional compilation
- Increase the portability of your code
- Refactor a large codebase into modules with the help of CMake
- Build multi-language projects
- Know where and how to tweak CMake configuration files written by somebody else
- Package projects for distribution
- Port projects to CMake
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(recipe-01 LANGUAGES CXX)
add_executable(hello-world hello-world.cpp)
Following is what you need for this book: If you are a software developer keen to manage build systems using CMake or would like to understand and modify CMake code written by others, this book is for you. A basic knowledge of C++, C, or Fortran is required to understand the topics covered in this book.
With the following software and hardware list you can run all code files present in the book (Chapter 1-15).
Chapter | Software required | OS required |
---|---|---|
1-15 | CMake >= 3.5 g++ supporting C++11 gcc supporting C99 gfortran Windows: msys2 installer or Visual Studio | Windows, Mac OS X, and Linux (Any) |
2 | Eigen 3.3.4 | Windows, Mac OS X, and Linux (Any) |
3 | Python interpreter Python development libraries: BLAS LAPACK MPI library Eigen 3.3.4 Boost 1.59 ZeroMQ | Windows, Mac OS X, and Linux (Any) |
4 | Boost 1.54 Catch2 Google Test | Windows, Mac OS X, and Linux (Any) |
5 | Python interpreter Python development libraries BLAS LAPACK | Windows, Mac OS X, and Linux (Any) |
6 | Python interpreter git | Windows, Mac OS X, and Linux (Any) |
8 | Boost 1.54 FFTW3 Eigen 3.3.4 | Windows, Mac OS X, and Linux (Any) |
9 | LAPACK | Windows, Mac OS X, and Linux (Any) |
11 | CFFI Anaconda pybind11 | Windows, Mac OS X, and Linux (Any) |
12 | Doxygen Sphinx Breathe | Windows, Mac OS X, and Linux (Any) |
13 | MXE Visual Studio | Windows, Mac OS X, and Linux (Any) |
14 | CDash | Windows, Mac OS X, and Linux (Any) |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
Radovan Bast works at the High Performance Computing Group at UiT - The Arctic University of Norway in Tromsø and leads the CodeRefinery project. He has a PhD in theoretical chemistry and contributes to a number of quantum chemistry programs as a code developer. He enjoys learning new programming languages and techniques, and teaching programming to students and researchers. He got in touch with CMake in 2008 and has ported a number of research codes and migrated a number of communities to CMake since then.
Roberto Di Remigio is a postdoctoral fellow in theoretical chemistry at UiT - The Arctic University of Norway in Tromsø, Norway and Virginia Tech, USA. He is currently working on stochastic methods and solvation models. He is a developer of the PCMSolver library and the Psi4 open source quantum chemistry program. He contributes or has contributed to the development of popular quantum chemistry codes and libraries: DIRAC, MRCPP, DALTON, LSDALTON, XCFun, and ReSpect. He usually programs in C++ and Fortran.
Click here if you have any feedback or suggestions.