Release Date: 10th December 2019
This is part of the change history for the book Professional CMake: A Practical Guide. The 5th Edition has been updated for the CMake 3.16.0 release and covers a number of new significant features as well as the usual set of minor improvements. Major highlights of this edition are a new chapter on build performance and a substantial new section in the Testing chapter covering the new fine-grained test resources functionality. The following lists the main changes in this edition.
Variables chapter:
- CMake 3.16 renamed the
--loglevel
option to--log-level
. - Added note about changed behavior in CMake 3.5.0 for whether
DEPRECATION
messages are shown by default or not.
Flow Control chapter:
- Addressed some minor inaccuracies in how the
if()
command interprets quoted constants. - Fixed incorrect logic and output for example for Interrupting Loops section.
Functions And Macros chapter:
- Removed unnecessary extra variable dereference in example for parsing function arguments.
Properties chapter:
- Mention that source properties can impact build performance due to interaction with unity builds.
Language Requirements chapter:
- CMake 3.16 added support for recognizing
OBJC
andOBJCXX
as their own distinct languages.
Target Types chapter:
- Fixed object library example that used
$<TARGET_SOURCES:...>
(which isn’t a valid generator expression) instead of$<TARGET_OBJECTS:...>
.
Custom Tasks chapter:
- Fixed missing quote for a
message()
command in anexecute_process()
example.
Specifying Version Details chapter:
- Added quotes around
COMPILE_DEFINITIONS
property value in example because it could be a list. - Added a call to
target_include_directories()
in example so thatfoobar_version.h
can be found.
Working With Files chapter:
- Added note highlighting that the
-f
option tocmake -E remove
does not behave as documented.
Toolchains And Cross Compiling chapter:
- CMake 3.16 restored support for Android NDK r19.
- Briefly expanded discussion of Android toolchain examples to compare results for GCC and Clang for NDK <r18, r18 and r19.
Apple Features chapter:
- Corrected and updated discussion of
CFBundleVersion
. - Mention new
OBJC
andOBJCXX
language support added in CMake 3.16.
Finding Things chapter:
- CMake 3.16 added support for a number of new variables of the form
CMAKE_FIND_USE_...
which can be used to change the defaults for the associated keyword options in the variousfind_...()
commands. - From CMake 3.16,
pkg_search_module()
now populates<prefix>_MODULE_NAME
with the module that was found. - Replaced all uses of the term “build slave” with other alternatives.
Testing chapter:
- Added a substantial new section Managing Test Resources which covers the new fine-grained test resource allocation functionality added in CMake 3.16.
- CMake 3.16 added support for a
COMMAND_EXPAND_LISTS
keyword foradd_test()
. - CMake 3.16 added support for a new test property
SKIP_REGULAR_EXPRESSION
. - Gave the ambiguity of the
-D
option forctest
more prominence. It now has its own specific warning callout in the text.
Installing chapter:
- Mentioned the new
file(GET_RUNTIME_DEPENDENCIES)
subcommand added in CMake 3.16. - Fixed variable dereferencing, naming and typos in main example of Config Files For CMake Projects section. The dependency on
BagOfBeans
was also switched to the mandatoryRuntime
component to simplify the example a little.
Packaging chapter:
- CMake 3.16 added direct support for creating multi-configuration packages with
cpack -C
. - CMake 3.16 added support for creating archives using Zstandard compression.
Build Performance chapter:
- New chapter focusing on techniques and CMake features for improving build performance.
- CMake 3.16 added support for unity builds and precompiled headers.
- Also contains sections covering
ccache
, split dwarf and using alternative linkers. The interaction between these and other features mentioned in the chapter is also discussed.