Professional CMake: A Practical Guide 22nd Edition

Release Date: 21st January 2026

This is part of the change history for the book Professional CMake: A Practical Guide. The 22nd Edition has been updated for the CMake 4.1 and CMake 4.2 releases, mostly with minor updates and incremental additions. A new AppImage CPack generator is the main new feature.


Setting Up A Project chapter:

  • Added the new Visual Studio 18 2026 generator to the table of commonly used generators. This generator was added in CMake 4.2.

Variables chapter:

  • Added the new set(CACHE{varName}) and unset(CACHE{varName}) command forms, new in CMake 4.2.

Generator Expressions chapter:

  • Briefly mention the new POSTFIX keyword now supported by some target-dependent generator expressions as of CMake 4.2.

Policies chapter:

  • Updated the advice in the Recommended Practices section to prefer using cmake_policy(VERSION) over cmake_minimum_required(VERSION) in Find modules to avoid leaking changes to the CMAKE_MINIMUM_REQUIRED_VERSION variable.

Build Type chapter:

  • Fixed two examples that were missing the VERSION keyword in a call to cmake_minimum_required().
  • Added a paragraph to the Custom Build Types section, explaining why the CMAKE_STATIC_LINKER_FLAGS_<CONFIG> variable is set to an empty string when defining the custom <CONFIG> configuration.

Compiler And Linker Essentials chapter:

  • Added some discussion to the De-duplicating Options section to highlight that the way de-duplication is done is not documented, and that it might not keep the occurrence one might expect.
  • Added a paragraph to the Recommended Practices section to advise appropriate use of the SHELL: prefix to avoid unwanted de-duplication, and avoid relying on de-duplication behaving a particular way when defining compiler and linker options.

Custom Tasks chapter:

  • Updated the Adding Build Steps To An Existing Target section to account for CMake 4.1 now accumulating content from the COMMENT keyword passed to add_custom_command(TARGET) instead of ignoring those comments. The Recommended Practices section was also updated for the same change.
  • Added a paragraph to the Platform Independent Commands section to highlight that forcing output at build time with cmake -E echo ... should be avoided now that COMMENT content is honored in add_custom_command(TARGET) output.

Working With Files chapter:

  • CMake 4.2 added support to cmake -E for copy_if_newer and copy_directory_if_newer subcommands.

Apple Features chapter:

  • CMake 4.1 officially documented as supported specifying a directory in MACOSX_PACKAGE_LOCATION and listing a directory as a source for a target so you could use that. This has worked unofficially for a long time, but it is now formally supported.

Build Performance chapter:

  • CMake 4.2 added support for a new UNITY_BUILD_FILENAME_PREFIX target property, which can be used to customize the build progress message when compiling unity sources for that target.
  • It is now possible to override the Ninja job pool for a specific source file using the new JOB_POOL_COMPILE source file property, as of CMake 4.2.

Test Frameworks chapter:

  • CMake 4.1 deprecated most variables for the FindGTest module. Projects should use only the module’s imported targets instead.

Static Code Analysis chapter:

  • CMake 4.2 added a new SKIP_LINTING target property and associated CMAKE_SKIP_LINTING CMake variable. These can be used to disable linting at the target level, whereas previously it had to be done on each source file individually.

Finding Things chapter:

  • Briefly mention that CMake 4.1 improved the information it records in the configure log for find_...() commands.

Package Generators chapter:

  • CMake 4.2 added a new AppImage generator.

ExternalProject chapter:

  • Added sub-section to the Miscellaneous Features section for improved navigation.
  • CMake 4.2 added support for modifying environment variables for the configure, build, test, and package steps, and for custom steps.

Dependency Providers chapter:

  • Modified examples and updated discussions to use cmake_policy(VERSION) rather than cmake_minimum_required(VERSION) when defining dependency providers. This is to avoid leaking changes to the CMAKE_MINIMUM_REQUIRED_VERSION variable into the main project.

Working With Qt chapter:

  • CMake 4.1 added support for a new AUTOMOC_INCLUDE_DIRECTORIES target property and associated CMAKE_AUTOMOC_INCLUDE_DIRECTORIES variable.
  • Qt 6.8 added a new target-based signature for qt_wrap_cpp(). The new form is discussed, and important limitations and bugs in the implementation of the function since Qt 6.8 are highlighted.
  • Qt 6.8 added a new qt_add_ui() command as a replacement for qt_wrap_ui(), which is still supported.