# CMake 4.2.0-rc1 is ready for testing

**URL:** https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251
**Category:** Announcements
**Created:** [October 16, 2025, 10:59pm UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251 "2025-10-16T22:59:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![johnwparent](https://discourse.cmake.org/user_avatar/discourse.cmake.org/johnwparent/32/2179_2.png) [@johnwparent](https://discourse.cmake.org/u/johnwparent)
#### Post date: [October 16, 2025, 10:59pm UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251/1 "2025-10-16T22:59:24Z")

</div>

I am proud to announce the first CMake 4.2 release candidate.

[https://cmake.org/download/](https://cmake.org/download/)

Documentation is available at:

[https://cmake.org/cmake/help/v4.2](https://cmake.org/cmake/help/v4.2)

Release notes appear below and are also published at

[https://cmake.org/cmake/help/v4.2/release/4.2.html](https://cmake.org/cmake/help/v4.2/release/4.2.html)

Release milestone is available at:  
[release milestone](https://gitlab.kitware.com/cmake/cmake/-/milestones/177)

Some of the most significant changes in CMake 4.2 are:

- The “Visual Studio 18 2026” generator was added. This is  
experimental and based on “Visual Studio 2026 Insiders” because this  
version of VS has not been released.

- The “FASTBuild” generator was added.

- CMake now supports Cross Compiling for Emscripten with simple  
toolchain files.

- The “set(CACHE{\<variable\>})” and “unset(CACHE{\<variable\>\>})” commands  
were added to explicitly set and unset cache entries.

- The “INSTALL\_OBJECT\_NAME” source file property was added to control  
names of installed object files for specific compiled sources.

- Nearly all find modules now provide a “\<PackageName\>\_VERSION” result  
variable matching the casing of its module name. Existing variants  
such as “\<PackageName\>\_VERSION\_STRING” and uppercased  
“\<PackageName\>\_VERSION” are deprecated. See documentation of each  
find module for details.

- The “ExternalProject” module’s “ExternalProject\_Add()” and  
“ExternalProject\_Add\_Step()” commands now provide options to set  
environment variables on the configure, build, install, and test  
steps.

- The “Visual Studio 14 2015” generator is now deprecated and will be  
removed in a future version of CMake.

CMake 4.2 Release Notes

* * *

Changes made since CMake 4.1 include the following.

# New Features

## File-Based API

- The “cmake-file-api(7)” “codemodel” version 2 “version” field has  
been updated to 2.9.

- The “cmake-file-api(7)” “codemodel” version 2 “target” and  
“directory” objects gained a new “codemodelVersion” field.

- The “cmake-file-api(7)” “codemodel” version 2 now includes imported  
targets and all interface library targets in its replies.  
Previously, imported targets were omitted, and only those interface  
targets that participated in the build system were included. The  
following changes support these new additions:

- The “cmake-file-api(7)” “codemodel” version 2 “target” object gained  
new “linkLibraries”, “interfaceLinkLibraries”,  
“compileDependencies”, “interfaceCompileDependencies”,  
“objectDependencies”, and “orderDependencies” fields.

## Generators

- The “Visual Studio 18 2026” generator was added. This is  
experimental and based on “Visual Studio 2026 Insiders” because this  
version of VS has not been released.

- The “FASTBuild” generator was added.

## Platforms

- CMake now supports Cross Compiling for Emscripten with simple  
toolchain files.

## Command-Line

- The “cmake(1)” command-line tool now supports “cmake -E  
copy\_if\_newer” and “cmake -E copy\_directory\_if\_newer” subcommands to  
copy files based on timestamp comparison instead of content  
comparison. These commands copy files only if the source is newer  
than the destination, providing better performance for build systems  
compared to “copy\_if\_different” which compares file contents.

## Commands

- The “cmake\_language(TRACE)” command was added to enable or disable  
tracing during script execution.

- The “set(CACHE{\<variable\>})” and “unset(CACHE{\<variable\>\>})” commands  
were added to explicitly set and unset cache entries.

- The “string(REGEX QUOTE)” command was added to generate a regular  
expression exactly matching a string.

## Variables

- The “CMAKE\_CXX\_STDLIB\_MODULES\_JSON” variable was added to set the  
path to the “import std” metadata file for the standard library  
rather than using the compiler to discover its location.

- The “CMAKE\_INTERMEDIATE\_DIR\_STRATEGY” variable and corresponding  
“CMAKE\_INTERMEDIATE\_DIR\_STRATEGY” environment variable were added to  
change the strategy used to name intermediate directories used for  
object files and other associated target metadata.

- The “CMAKE\_AUTOGEN\_INTERMEDIATE\_DIR\_STRATEGY” variable and  
corresponding “CMAKE\_AUTOGEN\_INTERMEDIATE\_DIR\_STRATEGY” environment  
variable were added to change the strategy used to name intermediate  
directories used for “Qt Autogen” files.

- The “CMAKE\_SKIP\_LINTING” variable and corresponding “SKIP\_LINTING”  
target property were added to tell the Command-Line Build Tool  
Generators to skip linting all sources in a target.

## Properties

- The “INSTALL\_OBJECT\_NAME” source file property was added to control  
names of installed object files for specific compiled sources.

- The “INSTALL\_OBJECT\_NAME\_STRATEGY” target property was added to  
control the naming strategy for installed object files.

- The “INSTALL\_OBJECT\_ONLY\_USE\_DESTINATION” target property was added  
to more precisely control the installation path for object files.

- The “JOB\_POOL\_COMPILE” source file property was added to assign  
individual source compilations to “JOB\_POOLS”.

- The “OBJECT\_NAME” source file property was added to control object  
names of compiled source files.

- The “UNITY\_BUILD\_FILENAME\_PREFIX” target property was added to  
control names of source files generated by “UNITY\_BUILD”.

## Modules

- Nearly all find modules now provide a “\<PackageName\>\_VERSION” result  
variable matching the casing of its module name. Existing variants  
such as “\<PackageName\>\_VERSION\_STRING” and uppercased  
“\<PackageName\>\_VERSION” are deprecated. See documentation of each  
find module for details.

- The “CheckTypeSize” module’s “check\_type\_size()” command gained a  
new “RESULT\_VARIABLE” keyword to customize the result variable name  
instead of the default “HAVE\_\<size\_var\>”.

- The “ExternalProject” module’s “ExternalProject\_Add()” and  
“ExternalProject\_Add\_Step()” commands now provide options to set  
environment variables on the configure, build, install, and test  
steps.

- The “FindPython3”, “FindPython2”, and “FindPython” modules no longer  
make “NumPy” depend on “Development.Module”. See policy “CMP0201”.

- The “GoogleTest” module’s “gtest\_discover\_tests()” command now sets  
the “DEF\_SOURCE\_LINE” test property for each discovered test if  
gtest supports the “–gtest\_output=json” option. This test property  
is used by some IDEs to locate the source for each test.

- The “UseSWIG” module’s “swig\_add\_library()” command gained a  
“DEBUG\_POSTFIX” option to control the “DEBUG\_POSTFIX” target  
property.

## Generator Expressions

- The “\<LANG\>\_COMPILER\_LINKER\_ID” and  
“\<LANG\>\_COMPILER\_LINKER\_FRONTEND\_VARIANT\*"\* families of generator  
expressions were added to access the value of the associated\*  
“CMAKE\_\<LANG\>\_COMPILER\_LINKER\_ID” and  
"\*CMAKE\_\<LANG\>\_COMPILER\_LINKER\_FRONTEND\_VARIANT” variables.

- The “TARGET\_FILE\_BASE\_NAME”, “TARGET\_IMPORT\_FILE\_BASE\_NAME”,  
“TARGET\_LINKER\_FILE\_BASE\_NAME”,  
“TARGET\_LINKER\_LIBRARY\_FILE\_BASE\_NAME”,  
“TARGET\_LINKER\_IMPORT\_FILE\_BASE\_NAME”, and  
“TARGET\_PDB\_FILE\_BASE\_NAME” generator expressions gained a “POSTFIX”  
option to control the inclusion of the “\<CONFIG\>\_POSTFIX” target  
property as part of the base names of the corresponding files.

- The “TARGET\_INTERMEDIATE\_DIR” generator expression was added to  
refer to a target’s intermediate files directory in the build tree.

## CPack

- The “CPACK\_PACKAGE\_CHECKSUM” variable now supports multiple values.

- The “CPack NSIS Generator” gained a “CPACK\_NSIS\_CRC\_CHECK” variable  
for setting the “CRCCheck” attribute.

- The “CPack WIX Generator” gained a “CPACK\_WIX\_CAB\_PER\_COMPONENT”  
variable to enable one “.cab” per component.

# Deprecated and Removed Features

- All find modules now provide a “\<PackageName\>\_FOUND” result variable  
matching the casing of its module name. Existing variants, such as  
the uppercased “\<PackageName\>\_FOUND”, are deprecated where  
appropriate. See documentation of each find module for details.

- The “FindwxWidgets” module’s result variable “wxWidgets\_USE\_FILE” is  
now deprecated in favor of including the “UsewxWidgets” module  
directly.

- The “Visual Studio 14 2015” generator is now deprecated and will be  
removed in a future version of CMake.

# Other Changes

- The “$\<CONFIG:cfgs\>” generator expression no longer matches multiple  
configurations. See policy “CMP0199”.

- Selection of configuration and location of imported targets is now  
more consistent. See policy “CMP0200”.

- The “CMAKE\_PARENT\_LIST\_FILE” variable is no longer defined when  
processing a “CMakeLists.txt” file. See policy “CMP0198”.

- For builds targeting the MSVC ABI, all generators now add the  
“\_MBCS” preprocessor definition when compiling sources unless  
“\_UNICODE” or “\_SBCS” is found. See policy “CMP0204”.

- For builds targeting the MSVC ABI, all generators now add the  
“\_WINDLL” preprocessor definition when compiling sources in shared  
libraries. See policy “CMP0203”.

---

<div class="post-metadata">

### Author: ![david-fong](https://discourse.cmake.org/user_avatar/discourse.cmake.org/david-fong/32/2388_2.png) [@david-fong](https://discourse.cmake.org/u/david-fong)
#### Post date: [October 18, 2025, 9:52am UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251/2 "2025-10-18T09:52:04Z")

</div>

Thanks to everyone involved for your work! I have some questions/comments:

> [@johnwparent](#):
>
> CMake now supports Cross Compiling for Emscripten with simple  
> toolchain files.

If I have something like the following in my CMakePresets.json, do I need to (or might I want to) change anything about it once I’m using CMake 4.2?

```json
{
	"name": "tool:emscripten",
	"hidden": true,
	"description": "available if you set/export EMSDK environment variable. good for IDEs which are hard to configure to use `emcmake cmake`.",
	"condition": {"type": "notEquals", "lhs": "$env{EMSDK}", "rhs": ""},
	"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",

```

* * *

> [@johnwparent](#):
>
> The “ExternalProject” module’s “ExternalProject\_Add()” and  
> “ExternalProject\_Add\_Step()” commands now provide options to set  
> environment variables on the configure, build, install, and test  
> steps.

If I have an external project that also uses CMake, and the main project gets environment variables from a CMake preset (and I rely on build, install, test, etc. to inherit from the configure preset), what would I need to do to have the external project get the same environment variables? Do I just do nothing, or do I need to manually forward the values for each of configure, build, install, and test?

* * *

> [@johnwparent](#):
>
> The “$CONFIG:cfgs” generator expression no longer matches multiple  
> configurations. See policy “CMP0199”.

Some escaping here is missing 🙂 and I got a minor scare before reading what the actual change is in [https://cmake.org/cmake/help/latest/policy/CMP0199.html](https://cmake.org/cmake/help/latest/policy/CMP0199.html). Much narrower than it sounds here and in the release notes. Maybe a little bit of elaboration could save some other readers from a similar scare?

* * *

Out of curiosity, is there an anticipated non-rc release date for CMake 4.2?

---

<div class="post-metadata">

### Author: ![david-fong](https://discourse.cmake.org/user_avatar/discourse.cmake.org/david-fong/32/2388_2.png) [@david-fong](https://discourse.cmake.org/u/david-fong)
#### Post date: [October 20, 2025, 11:03am UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251/3 "2025-10-20T11:03:03Z")

</div>

Not sure if I’m doing something wrong, but I followed the instructions at [https://apt.kitware.com/](https://apt.kitware.com/) to subscribe to release candidates for noble, but I don’t see 4.2 after `apt update`.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [October 20, 2025, 6:38pm UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251/4 "2025-10-20T18:38:23Z")

</div>

> [@david-fong](#):
>
> `apt.kitware.com`…I don’t see 4.2

Unfortunately there was a problem with the apt packaging process that’s delayed it.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [October 20, 2025, 6:40pm UTC](https://discourse.cmake.org/t/cmake-4-2-0-rc1-is-ready-for-testing/15251/5 "2025-10-20T18:40:58Z")

</div>

> [@david-fong](#):
>
> `$<CONFIG:cfgs>` generator expression no longer matches multiple  
> configurations … I got a minor scare before reading what the actual change is in `CMP0199`

I’ve opened [CMake MR 11331](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/11331) to clarify the release note.
