CMP0168 — CMake 3.31.4 Documentation (original) (raw)

Added in version 3.30.

The FetchContent module implements steps directly instead of through a sub-build.

CMake 3.29 and below implement FetchContent as a separate sub-build. This required configuring that separate project and using a build tool. This approach can be very slow with some generators and operating systems. CMake 3.30 and above prefer to implement the download, update, and patch steps directly as part of the main project.

The NEW behavior has the following characteristics:

The OLD behavior has the following characteristics:

There's a reasonably good chance that users can set theCMAKE_POLICY_DEFAULT_CMP0168variable to NEW to globally switch to the NEW behavior while waiting for the project and its dependencies to be updated use the NEW policy setting by default. Projects don't typically make use of the features that theNEW behavior no longer supports, and even those projects that do will often still work fine when those options are ignored. Before setting this behavior globally, check whether any FetchContent_Declare() orFetchContent_Populate() calls use the ignored options in a way that would change observable behavior, other than putting temporary or internally-generated files in different locations.

This policy was introduced in CMake version 3.30. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn, and uses OLD behavior.