Skip to content

FindOpenSSL: Be stricter in search of OpenSSL installations

Richard Levitte requested to merge levitte/cmake:fix-18352 into master

On Windows, FindOpenSSL mixes files from different installations when there is an installation from OpenSSL source and a Shining Light installation accessible at the same time. This was due to each file being looked up separately across all the HINTS and PATHS.

This change remedies that by using the search of OPENSSL_INCLUDE_DIR to calculate the likely installation root, and only searches within that root in all file searches that follow.

OPENSSL_ROOT_DIR may be changed, to reflect what OpenSSL root directory that was found.

All this is done generically, not just for Windows, to ensure that other mixups are avoided, even if that seems unlikely to happen. This also allows future additions to use a uniform template.

Fixes: #18352 (closed)

Merge request reports