BenW
BenW

Reputation: 959

Findopenssl.cmake fails to find OpenSSL, compiling restbed, C++

I'm trying to use cmake 3.7.2 on Debian 9.7 to compile restbed, a C++ framework for web services.

I follow the readme instructions. they're straight forward.

git clone --recursive https://github.com/corvusoft/restbed.git
mkdir restbed/build
cd restbed/build
cmake [-DBUILD_SSL=NO] ..
make install
make test

But i get the following error when running cmake:

-- Found ASIO include at: /home/ben/Workspaces/C_Experiments/restbed/dependency/asio/asio/include
-- Found Catch include at: /home/ben/Workspaces/C_Experiments/restbed/dependency/catch/single_include
CMake Error at cmake/Findopenssl.cmake:23 (message):
  Failed to locate OpenSSL dependency.  see restbed/dependency/openssl;
  ./config shared; make all
Call Stack (most recent call first):
  CMakeLists.txt:47 (find_package)

So I check Findopenssl.cmake, and find that it's looking in a number of places for the libraries.

find_library( ssl_LIBRARY_STATIC libssl.a  ssleay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY_STATIC libcrypto.a libeay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )

find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )

find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" )

if ( ssl_LIBRARY_STATIC AND ssl_LIBRARY_SHARED AND crypto_LIBRARY_STATIC AND crypto_LIBRARY_SHARED )
    set( OPENSSL_FOUND TRUE )
    add_definitions( -DBUILD_SSL=TRUE )

    if ( APPLE AND BUILD_SSL )
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
    endif( )

    message( STATUS "Found OpenSSL include at: ${ssl_INCLUDE}" )
    message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_STATIC}" )
    message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_SHARED}" )
    message( STATUS "Found Crypto library at: ${crypto_LIBRARY_STATIC}" )
    message( STATUS "Found Crypto library at: ${crypto_LIBRARY_SHARED}" )
else ( )
    message( FATAL_ERROR "Failed to locate OpenSSL dependency. see restbed/dependency/openssl; ./config shared; make all" )
endif ( )

I can't find these file either. I have openssl installed, version 1.1.0

What obvious thing am I missing here?

Thanks

Upvotes: 1

Views: 1245

Answers (2)

BenW
BenW

Reputation: 959

Brady Dean was correct, I had only openssl installed, not libssl-dev.

Upvotes: 1

Jajo
Jajo

Reputation: 31

Try using the cmake command without brackets:

cmake -DBUILD_SSL=NO ..

Upvotes: 3

Related Questions