Following log shows that cmake found openssl successfully:
$ cd wangle
$ cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ .
-- The C compiler identification is AppleClang 7.3.0.7030029
-- The CXX compiler identification is AppleClang 7.3.0.7030029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Folly: /usr/local/include
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Boost version: 1.60.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found OpenSSL: /usr/local/opt/openssl/lib/libssl.dylib;/usr/local/opt/openssl/lib/libcrypto.dylib (found version "1.0.2g")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/haoxun/Temp/wangle/wangle
But, make complains that <openssl/ssl.h> not found:
$ make
Scanning dependencies of target wangle
[ 1%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
In file included from /Users/haoxun/Temp/wangle/wangle/acceptor/Acceptor.cpp:10:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/acceptor/Acceptor.h:12:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:13:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/ssl/SSLContextConfig.h:14:
/usr/local/include/folly/io/async/SSLContext.h:26:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make[2]: *** [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
I've check the CMakeCache.txt, seems there's nothing wrong:
//Path to a library.
OPENSSL_CRYPTO_LIBRARY:FILEPATH=/usr/local/opt/openssl/lib/libcrypto.dylib
//Path to a file.
OPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include
//No help, variable specified on the command line.
OPENSSL_ROOT_DIR:UNINITIALIZED=/usr/local/opt/openssl/
//Path to a library.
OPENSSL_SSL_LIBRARY:FILEPATH=/usr/local/opt/openssl/lib/libssl.dylib
OPENSSL_INCLUDE_DIR detected by cmake is correct, of course:
System: OS X 10.11.4
openssl
is installed by homebrew,brew install openssl
.CMake command-line options:
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ .
Following log shows that
cmake
foundopenssl
successfully:But,
make
complains that<openssl/ssl.h>
not found:I've check the
CMakeCache.txt
, seems there's nothing wrong:OPENSSL_INCLUDE_DIR
detected bycmake
is correct, of course:In conclusion, I guess there's something wrong in the
CMakeLists.txt
.