mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
Merge topic 'explicit-source-extensions'
fd50a75fa0 CMP0115: Require source file extensions to be explicit
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !5346
This commit is contained in:
@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
|
||||
to determine whether to report an error on use of deprecated macros or
|
||||
functions.
|
||||
|
||||
Policies Introduced by CMake 3.20
|
||||
=================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
CMP0115: Source file extensions must be explicit. </policy/CMP0115>
|
||||
|
||||
Policies Introduced by CMake 3.19
|
||||
=================================
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
CMP0115
|
||||
-------
|
||||
|
||||
.. versionadded:: 3.20
|
||||
|
||||
Source file extensions must be explicit.
|
||||
|
||||
In CMake 3.19 and below, if a source file could not be found by the name
|
||||
specified, it would append a list of known extensions to the name to see if
|
||||
the file with the extension could be found. For example, this would allow the
|
||||
user to run:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
add_executable(exe main)
|
||||
|
||||
and put ``main.c`` in the executable without specifying the extension.
|
||||
|
||||
Starting in CMake 3.20, CMake prefers all source files to have their extensions
|
||||
explicitly listed:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
add_executable(exe main.c)
|
||||
|
||||
The ``OLD`` behavior for this policy is to implicitly append known extensions
|
||||
to source files if they can't be found. The ``NEW`` behavior of this policy is
|
||||
to not append known extensions and require them to be explicit.
|
||||
|
||||
This policy was introduced in CMake version 3.20. CMake version |release|
|
||||
warns when the policy is not set and uses ``OLD`` behavior. Use the
|
||||
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
||||
|
||||
.. include:: DEPRECATED.txt
|
||||
@@ -0,0 +1,5 @@
|
||||
explicit-source-extensions
|
||||
--------------------------
|
||||
|
||||
* Source file extensions must now be explicit. See policy :policy:`CMP0115` for
|
||||
details.
|
||||
Reference in New Issue
Block a user