CMP0115 — CMake 4.3.0 Documentation

# CMP0115

Added in version 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:

    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:

    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. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake warns, and uses `OLD` behavior.

Note

The `OLD` behavior of a policy is deprecated by definition and may be removed in a future version of CMake.