# Cannot find 'gettext' explicitly specifying the search PATHS in find\_package

**URL:** https://discourse.cmake.org/t/cannot-find-gettext-explicitly-specifying-the-search-paths-in-find-package/3859
**Category:** Usage
**Tags:** os:windows
**Created:** [August 1, 2021, 2:44pm UTC](https://discourse.cmake.org/t/cannot-find-gettext-explicitly-specifying-the-search-paths-in-find-package/3859 "2021-08-01T14:44:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jjELT](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jjELT](https://discourse.cmake.org/u/jjELT)
#### Post date: [August 1, 2021, 2:44pm UTC](https://discourse.cmake.org/t/cannot-find-gettext-explicitly-specifying-the-search-paths-in-find-package/3859/1 "2021-08-01T14:44:14Z")

</div>

I downloaded and extracted the latest [Gettext](https://mlocati.github.io/articles/gettext-iconv-windows.html) archive to a folder `${gettext_PATH_TO_BIN_FOLDER}`.

Additionally I have MSYS2 with gettext installed in `C:\msys64\mingw64\bin`. That path is part of my `PATH` environmental variable.

I cannot find Gettext via `find_package(Gettext PATHS ${gettext_PATH_TO_BIN_FOLDER})`, nor via `find_package(Gettext PATHS "C:/msys64/mingw64/bin")`!

If I only search for `find_package(Gettext)`, the version in “C:/msys64/mingw64/bin” is found.

If I `set(CMAKE_PREFIX_PATH ${gettext_PATH_TO_BIN_FOLDER})`, and still only use `find_package(Gettext)`, the version in ${gettext\_PATH\_TO\_BIN\_FOLDER})` is found.

This means, as soon as I add the `PATHS` option to the `find_package` function, CMake will definitively not find `Gettext`.

Am I wrong to assume this is a bug?

Here is a small sample project showing the problem: [cmake-find-gettext.zip](https://discourse.cmake.org/uploads/short-url/lI7CjDIraQT6AozrWMFhAQU9KIY.zip) (880 Bytes)

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [August 1, 2021, 3:13pm UTC](https://discourse.cmake.org/t/cannot-find-gettext-explicitly-specifying-the-search-paths-in-find-package/3859/2 "2021-08-01T15:13:59Z")

</div>

From the [documentation](https://cmake.org/cmake/help/latest/command/find_package.html):

> The CONFIG option, the synonymous NO\_MODULE option, or the use of options not specified in the basic signature all enforce pure Config mode.

So, specifying `PATHS` will enforce config mode which explain why it does not work as you expect.

---

<div class="post-metadata">

### Author: ![jjELT](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jjELT](https://discourse.cmake.org/u/jjELT)
#### Post date: [August 1, 2021, 3:27pm UTC](https://discourse.cmake.org/t/cannot-find-gettext-explicitly-specifying-the-search-paths-in-find-package/3859/3 "2021-08-01T15:27:58Z")

</div>

That does explain it, as `PATHS` is not part of the basic `find_package` signature.

I have not read the entire document, but only the part about the `PATHS` option, which is why I missed this information.

Thanks!
