Hi,
I a not very familiar with Cmake (or any make) so bare with me. 
I have a build log from my poudriere server available here : http://builder.newimage.nl/logs/bulk/FreeBSD_13-0_amd64-2021Q3/2021-09-15_01h03m11s/logs/mariadb-connector-odbc-3.1.11.log
I am unable to find any errors in the log, is just simply seems to ignore any SSL when linking.
The CMake output seems to detect OpenSSL :
{{ – Found OpenSSL: /usr/lib/libcrypto.so (found version "1.1.1k")
– Configuring to build with OpenSSL /usr/lib/libssl.so;/usr/lib/libcrypto.so}}
But is does not link
{{ – All linked targets/external dependencies: mariadbclient odbcinst m }}
And with the patch it does link with libsssl.
{{ – All linked targets/external dependencies: mariadbclient odbcinst /usr/lib/libssl.so;/usr/lib/libcrypto.so;m }}
I use an old patch file example wich i recreated for this version.
The original Bug report at freeBSD is here : https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247344
What i can see is that any other line with a SET(PLATFORM_DEPENDENCIES .... it includes the current ${PLATFORM_DEPENDENCIES} value only line 243 does not and with the detection of the LIB_MATH it is being overwritten.
Regards richard
Thank you for your report.
There is still
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${MARIADB_CLIENT_TARGET_NAME} ${ODBC_INSTLIBS} ${PLATFORM_DEPENDENCIES})
That should link c/odbc library against openssl library. If it was found. and if it was not found, there should been the cmake error, I think
At very least, your change should be limited to freebsd. But it feels like either the reason for the error is different, or it should be fixed differently.
Could you please show your cmake output?