[CMake] Anyone gotten OpenSSL to build as an external project?
kent williams
nkwmailinglists at gmail.com
Fri Jan 7 15:34:28 EST 2011
This shouldn't be a big deal -- something like this should work:
ExternalProject_add(OpenSSL
URL "http://www.openssl.org/source/openssl-1.0.0c.tar.gz"
URL_MD5 ff8fb85610aef328315a9decbb2712e4
CONFIGURE_COMMAND ./config --prefix="${CMAKE_CURRENT_BINARY_DIR}/OpenSSL"
BUILD_IN_SOURCE 1
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/OpenSSL"
)
set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/OpenSSL/include")
link_directories("${CMAKE_CURRENT_BINARY_DIR}/OpenSSL/libs)
set(OPENSSL_LIBRARIES ssl ssleay32 ssleay32MD)
The problem is that OpenSSL doesn't handle configuration scripts in
the usual way -- the configure script wants you to specify your
platform/compiler string.
They provide an 'automatic' script instead called config, so
config --prefix=...
Does mostly what you want, but they make you handle the OS X 64-bit
case manually -- it wants you to run configure and tell it explicitly
about the platform:
./Configure darwin64-x86_64-cc
This is kind of crazy, but OK, whatever. So I need to try and figure
out at configure time if it's an OS X build and if it's a 64 bit
build. I can use
if(APPLE)
to detect an Mac platform, but there's no way I can figure out to
determine if the currently selected build type is 64 bits. And I
think that the stock OpenSSL distribution would completely lose its
mind if you tried to configure a Universal Binary build!
Any suggestions?
More information about the CMake
mailing list