cmake: support OpenSSL in non-standard locations

When OpenSSL exists in a non-standard location, compilation
fails:
    export OPENSSL_ROOT_DIR=/usr/local/openssl
    cmake ...
    make ...
    | gcc  -Ihost/xtest/. -Ihost/xtest/adbg/include -Ihost/xtest/xml/include \
           -I<user-ta>/host_include -Ihost/xtest -Ita/include \
           -Ita/aes_perf/include -Ita/concurrent/include \
           -Ita/concurrent_large/include -Ita/create_fail_test/include \
           -Ita/crypt/include -Ita/enc_fs/include -Ita/os_test/include \
           -Ita/rpc_test/include -Ita/sdp_basic/include -Ita/sha_perf/include \
           -Ita/sims/include -Ita/miss/include -Ita/sims_keepalive/include \
           -Ita/socket/include -Ita/storage_benchmark/include ... \
           -DOPENSSL_FOUND=1 ... \
           -MD -MT host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
           -MF host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o.d \
           -o host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
           -c host/xtest/regression_8100.c
    | host/xtest/regression_8100.c:17:10: fatal error: openssl/x509_vfy.h: No such file or directory
    |  #include <openssl/x509_vfy.h>
    |           ^~~~~~~~~~~~~~~~~~~~
    | compilation terminated.

The reason is that while CMake will find OpenSSL using above export,
and also populate various variables to access the result, those
variables aren't being used in here.

In particular, CMake adds 'Imported Targets' variables that are
meant to be used, OpenSSL::Crypto in this case. They serve multiple
purposes:
   * library (file names) are abstracted away
   * specific include paths are added automatically to the compiler
     command line where needed

So this here needs to switch over to using those.

Note that support for OpenSSL imported targets was added in CMake
v3.4 only and hence we also have to bump the minimum required
version to reflect that fact. Given v3.4 was releasd in 2015,
this is not deemed to be an issue.

Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2 files changed
tree: c1164eb7252dcfadcf103deef41c6ea354dfac37
  1. cert/
  2. host/
  3. package/
  4. scripts/
  5. ta/
  6. .gitignore
  7. Android.mk
  8. CMakeLists.txt
  9. CMakeToolchain.txt
  10. LICENSE.md
  11. Makefile
  12. README.md
README.md

OP-TEE sanity testsuite

This git contains source code for the test suite (xtest) used to test the OP-TEE project.

All official OP-TEE documentation has moved to http://optee.readthedocs.io. The information that used to be here in this git can be found under optee_test.

// OP-TEE core maintainers