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})andunset(CACHE{varName})command forms, new in CMake 4.2.
Generator Expressions chapter:
- Briefly mention the new
POSTFIXkeyword 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)overcmake_minimum_required(VERSION)in Find modules to avoid leaking changes to theCMAKE_MINIMUM_REQUIRED_VERSIONvariable.
Build Type chapter:
- Fixed two examples that were missing the
VERSIONkeyword in a call tocmake_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
COMMENTkeyword passed toadd_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 thatCOMMENTcontent is honored inadd_custom_command(TARGET)output.
Working With Files chapter:
- CMake 4.2 added support to
cmake -Eforcopy_if_newerandcopy_directory_if_newersubcommands.
Apple Features chapter:
- CMake 4.1 officially documented as supported specifying a directory in
MACOSX_PACKAGE_LOCATIONand 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_PREFIXtarget 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_COMPILEsource file property, as of CMake 4.2.
Test Frameworks chapter:
- CMake 4.1 deprecated most variables for the
FindGTestmodule. Projects should use only the module’s imported targets instead.
Static Code Analysis chapter:
- CMake 4.2 added a new
SKIP_LINTINGtarget property and associatedCMAKE_SKIP_LINTINGCMake 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 thancmake_minimum_required(VERSION)when defining dependency providers. This is to avoid leaking changes to theCMAKE_MINIMUM_REQUIRED_VERSIONvariable into the main project.
Working With Qt chapter:
- CMake 4.1 added support for a new
AUTOMOC_INCLUDE_DIRECTORIEStarget property and associatedCMAKE_AUTOMOC_INCLUDE_DIRECTORIESvariable. - 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 forqt_wrap_ui(), which is still supported.