Skip to content

CMake shouldn't mention CMAKE_PREFIX_PATH if CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is set to ONLY

When CMake fails to find a package, it will display a (in this case, misleading) error:

CMake Error at CMakeLists.txt:23 (find_package): Could not find a package configuration file provided by "OpenSSL" (requested version 1.0.2) with any of the following names:

OpenSSLConfig.cmake
openssl-config.cmake

Add the installation prefix of "OpenSSL" to CMAKE_PREFIX_PATH or set "OpenSSL_DIR" to a directory containing one of the above files. If "OpenSSL" provides a separate development package or SDK, be sure it has been installed.

This is very misleading when CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is set to ONLY because it will NOT use CMAKE_PREFIX_PATH.

I think the message should be changed in that case to provide the user a good way to either override the behavior (he probably intended for CMAKE_PREFIX_PATH to work in the first place if he provided it).

Note that this leads to such issues: #19655 #17272

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information