[CMake] FindOpenSSL always uses system libs

Josef 'Jeff' Sipek jeffpc at josefsipek.net
Wed Aug 14 14:06:54 EDT 2013


If you have a (linux or solaris) system with openssl installed in /usr and a
second copy installed elsewhere (e.g., /opt) and you want a cmake project to
find the elsewhere version, no matter what you try it finds the system copy.
(In other words, OPENSSL_ROOT_DIR has no effect.)  Are we missing something or
is this a bug in FindOpenSSL?  We've tested cmake 2.8.5, 2.8.8, and 2.8.11
without any luck.

Thanks,

Jeff.


Example:

jsipek at poseidon:/tmp/ssltest$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 2.8.5)
project(test)

find_package(OpenSSL REQUIRED)
jsipek at poseidon:/tmp/ssltest$ rm CMakeCache.txt && OPENSSL_ROOT_DIR=/tmp/ossl/ cmake . -DOPENSSL_ROOT_DIR=/tmp/ossl/
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/gnu/bin/gcc
-- Check for working C compiler: /usr/gnu/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/gnu/bin/c++
-- Check for working CXX compiler: /usr/gnu/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenSSL: /usr/lib/libssl.so;/usr/lib/libcrypto.so (found version "0.9.8x") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ssltest
jsipek at poseidon:/tmp/ssltest$ find /tmp/ossl/lib/
/tmp/ossl/lib/
/tmp/ossl/lib/engines
/tmp/ossl/lib/pkgconfig
/tmp/ossl/lib/pkgconfig/libcrypto.pc
/tmp/ossl/lib/pkgconfig/libssl.pc
/tmp/ossl/lib/pkgconfig/openssl.pc
/tmp/ossl/lib/libcrypto.a
/tmp/ossl/lib/libssl.a

-- 
mainframe, n.:
  An obsolete device still used by thousands of obsolete companies serving
  billions of obsolete customers and making huge obsolete profits for their
  obsolete shareholders. And this year's run twice as fast as last year's.


More information about the CMake mailing list