我通过macports安装了最新版本的OpenSSL(1.0.2q),并试图在我的mac上构建一个依赖OpenSSL的项目,发现CMake似乎返回了错误的库路径或错误的包含路径:
message("@@@")
message(${OPENSSL_INCLUDE_DIR})
message(${OPENSSL_SSL_LIBRARY})
message("/@@@")
@@@
/opt/local/include
/usr/lib/libssl.dylib
/@@@
因此,它为我提供了macports中OpenSSL的头文件和系统中的库文件。
我发现这是因为构建外部库失败并出现链接错误:
Undefined symbols for architecture x86_64:
"_X509_check_host", referenced from:
_ma_tls_verify_server_cert in libmariadbclient.a(openssl.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
如何使CMake仅查找和使用macports库?