CMP0187 — CMake 4.3.0 Documentation

# CMP0187

Added in version 4.1.

Include source file without an extension after the same name with an extension.

In CMake 4.0 and below, if two source files have the same filename and only one file has a file extension and the file with the extension is listed first, the file without the extension is omitted from the target.

For example, the following library target only include `hello.c` in the target, but omits the file `hello`.

    add_library(library hello.c hello)

If the file without the extension is listed before the file with the extension, both files are included in the target.

Starting in CMake 4.1, CMake includes both files in the library target.

This policy has no effect if `CMP0115` uses the `OLD` behavior.

The `OLD` behavior for this policy is to omit the file without the extension. The `NEW` behavior for this policy is to include it.

This policy was introduced in CMake version 4.1. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake does not warn, 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.