[CMake] How do you tell FindOpenSSL to find OpenSSL in a non-standard path?

Michael Wild themiwi at gmail.com
Thu Jun 23 15:15:45 EDT 2011


On 06/23/2011 08:50 PM, Quanah Gibson-Mount wrote:
> I see that mysql recently switched to using Cmake.  Previously, when
> using configure, I could tell mysql where to find our custom OpenSSL
> installation, and link mysql to it.  So far, however, I'm having no luck
> getting cmake to do this.
> 
> Currently I have:
> 
> /usr/bin/cmake . -DWITH_SSL=system
> -DOPENSSL_INCLUDE_DIR=/opt/zimbra/openssl-1.0.0d/include
> -DOPENSSL_LIBRARIES=/opt/zimbra/openssl-1.0.0d/lib
> -DCMAKE_INSTALL_PREFIX=/opt/zimbra/mysql-5.5.28 -DENABLED_PROFILING=on
> -DWITH_READLINE=TRUE
> 
> However, this always errors out that it can't find the
> SHA512_DIGEST_LENGTH variable set in openssl/sha.h, which exists:
> 
> #define SHA512_DIGEST_LENGTH    64
> 
> 
> How do I tell Cmake where to find my openssl build?
> 
> Thanks!
> 
> --Quanah
> 
> -- 
> 
> Quanah Gibson-Mount
> Sr. Member of Technical Staff
> Zimbra, Inc
> A Division of VMware, Inc.
> --------------------
> Zimbra ::  the leader in open source messaging and collaboration

Usually it is better to set CMAKE_PREFIX_PATH to
/opt/zimbra/openssl-1.0.0d, and then let FindOpenSSL.cmake do its work.
Without looking at FindOpenSSL.cmake, the -DOPENSSL_LIBRARIES=...
argument looks fishy to me, because usually XXX_LIBRARIES variables are
not cached, but a concatenation of various XXX_LIBRARY variables.

HTH

Michael


More information about the CMake mailing list