# Which search paths are disabled by specifying NO\_DEFAULT\_PATH in find\_xxx commands?

**URL:** <https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060>\
**Category:** Code\
**Created:** [February 12, 2024, 12:34pm UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060 "2024-02-12T12:34:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hwhsu1231](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hwhsu1231/32/5358_2.png) [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Post date:** [February 12, 2024, 12:34pm UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060/1 "2024-02-12T12:34:47Z")

</div>

Hello, CMake Team.

From the content of the CMake documentation, it is known:

For the `find_xxx` family of commands, the search is generally conducted in the following order:

1. paths in `<PackageName>_ROOT` cache/environment variables.
2. paths in CMake-specific cache variables.
3. paths in CMake-specific environment variables.
4. paths in the `HINTS` option.
5. paths in standard system environment variables (PATH env).
6. paths in CMake variables defined in Platform files.
7. paths in the `PATHS` option.

However, what confuses me is:

1. Firstly, according to the description in the `find_program` documentation, if `NO_DEFAULT_PATH` is specified, then `find_program` will not search any of the additional paths specified above.

2. However, from the content of the [`FindOpenSSL.cmake`](https://github.com/Kitware/CMake/blob/v3.28.3/Modules/FindOpenSSL.cmake#L234-L235) and the examples in the [`find_program`](https://cmake.org/cmake/help/v3.28/command/find_program.html) documentation, it seems that `NO_DEFAULT_PATH` does not affect the additional paths specified in the `PATHS` and `HINTS` options.

Therefore, I would like to confirm:

> Which search paths are disabled by specifying `NO_DEFAULT_PATH` in `find_xxx` commands?

---

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [February 12, 2024, 5:43pm UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060/2 "2024-02-12T17:43:23Z")

</div>

If `NO_DEFAULT_PATH` is specified, only  
`HINTS`, `PATHS`, which Specify directories to search in addition to the default locations,  
and `ENV` var sub-option, which reads paths from a system environment variable  
are used.

---

<div class="post-metadata">

**Author:** ![hwhsu1231](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hwhsu1231/32/5358_2.png) [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Post date:** [February 13, 2024, 10:47am UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060/3 "2024-02-13T10:47:15Z")

</div>

Hello, CMake Team.

I found that the description of `NO_DEFAULT_PATH` in [`find_package`](https://cmake.org/cmake/help/v3.28/command/find_package.html) manual:

> If `NO_DEFAULT_PATH` is specified all `NO_*` options are enabled.

is more suitable than the ones in other `find_xxx` manuals:

> If `NO_DEFAULT_PATH` is specified, then no additional paths are added to the search.

How about unifying the description of `NO_DEFAULT_PATH` in other `find_xxx` manuals to match that of `find_package`?

Otherwise, this could lead to confusion.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [February 17, 2024, 6:20am UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060/4 "2024-02-17T06:20:20Z")

</div>

That sounds good to me; do you mind making an MR? If not, an issue would help to track this better.

---

<div class="post-metadata">

**Author:** ![hwhsu1231](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hwhsu1231/32/5358_2.png) [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)\
**Post date:** [February 17, 2024, 7:36am UTC](https://discourse.cmake.org/t/which-search-paths-are-disabled-by-specifying-no-default-path-in-find-xxx-commands/10060/5 "2024-02-17T07:36:18Z")

</div>

I’ve created an issue to track my suggestion:

[https://gitlab.kitware.com/cmake/cmake/-/issues/25687](https://gitlab.kitware.com/cmake/cmake/-/issues/25687)
