Don't explicitely include FindOpenSSL.cmake #2171
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is no need to do this because find_package is documented to do this for you and vcpkg has a toolchain file that short circuits find_package for OpenSSL. This does not work correctly if you explicitly include FindOpenSSL in your CMakeLists.txt file.
You can reproduce this issue by installing OpenSSL 1.1.1w from Shining Light Productions OpenSSL in C:\Program Files\OpenSSL then setting up vcpkg on windows with visual studio and calling
then try to build rnp with
After doing this the include files will be the OpenSSL 3.2 version in vcpkg but the libraries for the debug configuration in the generated visual studio solution will be the ones from OpenSSL 1.1.1 in Program Files. This will of course cause a bunch of undefined symbols at link time.
Removing the explicit include of FindOpenSSL fixes this and as I mentioned before it shouldn't be necessary to ever do that because find_package will implicitly include that for you.