FindOpenSSL.cmake strips library keyword information
Hi,
when attempting to build mosquitto[1] with TLS support and CMake[2], when specifying the OpenSSL parameters from the command line[3] the resulting FindPackage(OpenSSL) invocation strips the 'debug' and 'optimized' keywords from the OPENSSL_LIBRARIES string, leading to an errorneously linked mosquitto.exe in debug buils[4]. This can be easily seen by adding something like message(STATUS "OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES}")
around line 418 in FindOpenSSL.cmake. The use of REMOVE_DUPLICATES here is clearly wrong, because the duplicate 'debug' and 'optimized' values in the list are required for a correct build.
[1] https://mosquitto.org/files/source/mosquitto-1.6.8.tar.gz
[2] CMake Version 3.16.1
[3] cmake -S mosquitto-1.6.8/ -Bbld -DLIB_EAY_DEBUG=openssl/lib_nt/libeay32_vc141_x86_dbg.lib -DLIB_EAY_RELEASE=openssl/lib_nt/libeay32_vc141_x86.lib -DSSL_EAY_DEBUG=openssl/lib_nt/ssleay32_vc141_x86_dbg.lib -DSSL_EAY_RELEASE=openssl/lib_nt/ssleay32_vc141_x86.lib -DOPENSSL_INCLUDE_DIR=openssl/include