find_package not searching the expected directories in config mode
When looking for a config script for a package using
find_package(foo CONFIG REQUIRED PATHS "C:/local" NO_DEFAULT_PATH)
CMake does not seem to look into all the paths mehtioned in the documentation of find_package
. Activating the debug mode prints the following checked locations:
C:/local/fooConfig.cmake
C:/local/foo-config.cmake
However according to the documentation additional file paths should be considered including:
- C:/local/cmake/fooConfig.cmake
- C:/local/lib/fooConfig.cmake
- C:/local/lib/cmake/fooConfig.cmake
Powershell commands run from the directory containing CMakeLists.txt
:
mkdir build
cmake -G "Visual Studio 16 2019" -A x64 -S . -B build > log.txt 2>&1
Details:
- OS: Win10
- CMake version 3.20.2 (installed via cmake-3.20.2-windows-x86_64.msi)