[CMake] Anyone gotten OpenSSL to build as an external project?
David Cole
david.cole at kitware.com
Fri Jan 7 15:48:32 EST 2011
In a project where the CXX language has been enabled (project or
enable_language commands), and there's only one architecture, you can use
the following:
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64-bit build
else()
# 32-bit build
endif()
Or are you trying to build a universal binary and you have multiple OSX
architectures in the containing project? If that's the case, then I'm not
sure off the top of my head. I'd have to dig to figure it out...
Let us know if that helps,
David
On Fri, Jan 7, 2011 at 3:34 PM, kent williams <nkwmailinglists at gmail.com>wrote:
> 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?
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110107/13b4ae65/attachment.htm>
More information about the CMake
mailing list