# CMAKE\_PREFIX\_PATH with clang-cl didn't find package

**URL:** https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109
**Category:** Usage
**Tags:** os:windows, comp:clang, gen:ninja
**Created:** [December 3, 2024, 4:23am UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109 "2024-12-03T04:23:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gaz0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gaz0/32/4466_2.png) [@gaz0](https://discourse.cmake.org/u/gaz0)
#### Post date: [December 3, 2024, 4:23am UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109/1 "2024-12-03T04:23:06Z")

</div>

I had a small MSVC x64 project using the template library inja, just to check that I could work with it in a larger project. It used find\_package to locate where cget installed the inja package. To do that I set CMAKE\_PREFIX\_PATH to the cget directory. I set up the same project to also build using clang-cl x64 and the ninja build tool. However, to allow it to find inja I had to set inja\_DIR; it seemed to ignore CMAKE\_PREFIX\_DIR. I am wondering if anyone could explain why that is, or suggest how I might investigate. The project is here: [GitHub - coder451/cmake-find-inja: Small project using inja with cmake](https://github.com/coder451/cmake-find-inja).

---

<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: [December 3, 2024, 6:44am UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109/2 "2024-12-03T06:44:18Z")

</div>

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

see [config-mode-search-procedure](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure)

---

<div class="post-metadata">

### Author: ![gaz0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gaz0/32/4466_2.png) [@gaz0](https://discourse.cmake.org/u/gaz0)
#### Post date: [December 3, 2024, 10:25am UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109/3 "2024-12-03T10:25:29Z")

</div>

Without NO\_DEFAULT\_PATH it fails in the same way after looking in various irrelevant places.

---

<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: [December 3, 2024, 10:50am UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109/4 "2024-12-03T10:50:50Z")

</div>

try [cmake --debug-find-pkg=…](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-debug-find-pkg)

---

<div class="post-metadata">

### Author: ![gaz0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gaz0/32/4466_2.png) [@gaz0](https://discourse.cmake.org/u/gaz0)
#### Post date: [December 3, 2024, 8:33pm UTC](https://discourse.cmake.org/t/cmake-prefix-path-with-clang-cl-didnt-find-package/13109/5 "2024-12-03T20:33:41Z")

</div>

Thanks for that. Running with it showed me what was going on. But it looks like this is a Heisenbug - today the two builds are behaving the same. Sorry for the noise.
