[CMake] Anyone gotten OpenSSL to build as an external project?

Pau Garcia i Quiles pgquiles at elpauer.org
Fri Jan 14 15:43:11 EST 2011


Hi,

I'm trying to get this working on Windows using a self-contained build
environment that does NOT have Perl in path.

It's a .bat file which downloads CMake and Perl and then fires a
CMakeLists.txt with the ExternalProject_Add to build zlib (no problem
after the patches I sent yesterday) and OpenSSL.

One problem I've found is the PATH environment variable.
ExternalProject_Add does not allow to set it, which forces me to use
CMake in command mode + set (ENV{PATH} ... ) + execute_process. Ugly.

Features I'm missing in ExternalProject_Add and I just realized
"thanks" to OpenSSL:
- Add a PATH parameter to ExternalProject_Add,
ExternalProject_Add_Step and execute_process. It should override the
default path. Adding new directories to the path would be possible by
doing PATH "$ENV{PATH}:/my/new/dir/in/path"
- Define variables for SOURCE_DIR, BINARY_DIR, etc even if EP_PREFIX
and EP_BASE are not set
- Allow for multiple CONFIGURE_COMMAND steps (I know, I can add my
custom step, but it's much more complex)

Another more issue I'm seeing with ExternalProject_Add is tarballs
with symlinks on Windows. The OpenSSL contains symlinks, which leads
to a broken source dir because CMake is unable to create some files.
Maybe CMake should pass libarchive some parameter? (if I extract the
OpenSSL tarball with WinRAR, it does not fail)

On Fri, Jan 7, 2011 at 9: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
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list