Hel*_*hka 9 macos homebrew openssl cmake
我正在使用以下cmake命令
# Search OpenSSL
find_package(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl)
if( OPENSSL_FOUND )
include_directories(${OPENSSL_INCLUDE_DIRS})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
else()
# Error; with REQUIRED, pkg_search_module() will throw an error by it's own
endif()
Run Code Online (Sandbox Code Playgroud)
它适用于Linux和Mac - 但在Mac上它使用osx发布的libssl - 它会抛出很多弃用警告,例如 'SSL_library_init' is deprecated: first deprecated in OS X 10.7"
使用brew我已经安装了一个更新的 - openssl -offical - libssl - 我怎么能告诉pkg_search_modulecmake找到并使用brew版本?
问候
Jon*_*tan 11
截至2016年底,这对我有用:
在CMakeLists.txt中:
find_package(openssl REQUIRED)
Run Code Online (Sandbox Code Playgroud)
像这样运行cmake:
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl .
Run Code Online (Sandbox Code Playgroud)
确定它工作:)
brew upgrade openssl
brew link --force openssl
pkg-config --modversion openssl
#1.0.2
Run Code Online (Sandbox Code Playgroud)
删除了cmake构建文件夹并重新运行cmake ..,上面的宏现在找到1.0.2 libssl :)
| 归档时间: |
|
| 查看次数: |
5755 次 |
| 最近记录: |