Cmake how to link to OpenSSL on device? Or should I? -
we have crossplatform app using cmake , have been linking precompiled openssl binaries. link android , ios's own openssl.
- how in cmake?
- we avoid using binary not compatible os version. valid or typical concern?
if wanting link apple-provided openssl libraries, may want rethink strategy. apple have following text in cryptographic services guide (emphasis mine):
although openssl commonly used in open source community, openssl not provide stable api version version. reason, although os x provides openssl libraries, openssl libraries in os x deprecated, and openssl has never been provided part of ios. use of os x openssl libraries apps discouraged.
if app depends on openssl, should compile openssl , statically link known version of openssl app. use of openssl possible on both os x , ios. however, unless trying maintain source compatibility existing open source project, should use different api.
also see answers here , here. ios @ least, have build own openssl anyway. 1 argue want android builds consistency , similar reasons in extract above apple.
as @tsyvarev said in comment on question, use find_package()
appropriate hints point build @ openssl want use. question indicates use own pre-built openssl, presumably in control of located , using find_package() nice platform independent way handle different library suffixes, etc. recent versions of cmake give import targets carry them include path dependencies, easier code use (just link them , header search path openssl added free). have read of cmake docs findopenssl module details.
Comments
Post a Comment