Cannot find 'gettext' explicitly specifying the search PATHS in find_package

I downloaded and extracted the latest Gettext 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: (880 Bytes)

From the documentation:

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.

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.