1CMP0120
2-------
3
4.. versionadded:: 3.20
5
6The :module:`WriteCompilerDetectionHeader` module is removed.
7
8CMake versions 3.1 through 3.19 provide this module to generate a
9C++ compatibility layer by re-using information from CMake's table of
10preprocessor checks for :manual:`cmake-compile-features(7)`.  However:
11
12* Those granular features have been superseded by meta-features for
13  :ref:`Requiring Language Standards` such as ``cxx_std_11``.  Therefore
14  no new granular feature checks will be added and projects will need to
15  use other means to conditionally use new C++ features.
16
17* The module exposes some of CMake's implementation details directly
18  to C++ translation units.
19
20* The module's approach effectively provides a header file with CMake,
21  thus tying the version of the header to the version of CMake.
22  Many projects found that the :module:`WriteCompilerDetectionHeader` was
23  best used by manually generating its header locally with a recent version
24  of CMake and then bundling it with the project source so that it could
25  be used with older CMake versions.
26
27For reasons including the above, CMake 3.20 and above prefer to not
28provide the :module:`WriteCompilerDetectionHeader` module.  This policy
29provides compatibility for projects that have not been ported away from
30it.  Projects using the module should be updated to stop using it.
31Alternatives include:
32
33* Bundle a copy of the generated header in the project's source.
34* Use a third-party alternative, such as the CC0-licensed `Hedley`_.
35* Drop support for compilers too old to provide the features natively.
36
37The ``OLD`` behavior of this policy is for inclusion of the deprecated
38:module:`WriteCompilerDetectionHeader` module to work.  The ``NEW``
39behavior is for inclusion of the module to fail as if it does not exist.
40
41This policy was introduced in CMake version 3.20.  CMake version |release|
42warns when the policy is not set and uses ``OLD`` behavior. Use the
43:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
44
45.. include:: DEPRECATED.txt
46
47.. _`Hedley`: https://nemequ.github.io/hedley/
48