# CMake: Use NAMES_PER_DIR in all lookups · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/dd70336f3ace541586210bd7bd061cc09a8c0e03)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: dd70336f3ace541586210bd7bd061cc09a8c0e03

Requested commit: dd70336f3ace541586210bd7bd061cc09a8c0e03

Commit: dd70336f3ace541586210bd7bd061cc09a8c0e03

Tree: badb6ba2ced8240adfdae419f175dd2dc1b09267

Author: Cody Tapscott

Committer: Andrew Kelley

## Message

```
CMake: Use NAMES_PER_DIR in all lookups

CMake has a surprising default behavior where looking up a library by
multiple names gives the name order higher priority than the directory
search order.

For example, if your system provides "llvm-config-14" and
CMAKE_PREFIX_PATH includes "llvm-config", CMake will always end up
choosing the system-provided llvm-config-14.

This change add NAMES_PER_DIR to request the more sensible behavior:
directory search order has higher priority than name order, so
CMAKE_PREFIX_PATH always wins over system-provided tools/libraries.

```

## Parents

- [a4559271501670b39305fc3575ae8d87fa03d35e](https://git.cafe/gitcafe/zig/commit/a4559271501670b39305fc3575ae8d87fa03d35e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/dd70336f3ace541586210bd7bd061cc09a8c0e03?format=markdown)
