diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2015-08-07 11:13:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-08-13 14:58:40 (GMT) |
commit | 75e3a8e811b290cb9921887f2b086377af90880f (patch) | |
tree | 69e9bcc1d437a01da364f2804551703766672b51 /Tests | |
parent | 79a364376ca7b4b598b4827031a7515ffd497f24 (diff) | |
download | CMake-75e3a8e811b290cb9921887f2b086377af90880f.zip CMake-75e3a8e811b290cb9921887f2b086377af90880f.tar.gz CMake-75e3a8e811b290cb9921887f2b086377af90880f.tar.bz2 |
FindOpenSSL: Provide imported targets OpenSSL::{SSL,Crypto}
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindOpenSSL/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/FindOpenSSL/rand/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindOpenSSL/rand/main.cc | 22 |
4 files changed, 49 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5781a9e..35b29bf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1333,6 +1333,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + if(CMake_TEST_FindOpenSSL) + add_subdirectory(FindOpenSSL) + endif() + # Matlab module if(CMake_TEST_FindMatlab) ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) diff --git a/Tests/FindOpenSSL/CMakeLists.txt b/Tests/FindOpenSSL/CMakeLists.txt new file mode 100644 index 0000000..66b3fb2 --- /dev/null +++ b/Tests/FindOpenSSL/CMakeLists.txt @@ -0,0 +1,9 @@ +add_test(NAME FindOpenSSL.rand COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOpenSSL/rand" + "${CMake_BINARY_DIR}/Tests/FindOpenSSL/rand" + ${build_generator_args} + --build-project FindOpenSSL_rand + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) diff --git a/Tests/FindOpenSSL/rand/CMakeLists.txt b/Tests/FindOpenSSL/rand/CMakeLists.txt new file mode 100644 index 0000000..520d5d2 --- /dev/null +++ b/Tests/FindOpenSSL/rand/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.0) +project(FindOpenSSL_rand CXX) +include(CTest) + +find_package(OpenSSL REQUIRED) + +add_executable(tstopensslrand_tgt main.cc) +target_link_libraries(tstopensslrand_tgt OpenSSL::SSL) +add_test(NAME tstopensslrand_tgt COMMAND tstopensslrand_tgt) + +add_executable(tstopensslrand_var main.cc) +target_link_libraries(tstopensslrand_var ${OPENSSL_LIBRARIES}) +target_include_directories(tstopensslrand_var PRIVATE ${OPENSSL_INCLUDE_DIR}) +add_test(NAME tstopensslrand_var COMMAND tstopensslrand_var) diff --git a/Tests/FindOpenSSL/rand/main.cc b/Tests/FindOpenSSL/rand/main.cc new file mode 100644 index 0000000..a5d1ac0 --- /dev/null +++ b/Tests/FindOpenSSL/rand/main.cc @@ -0,0 +1,22 @@ +#include <openssl/rand.h> + +int main() +{ + // return value + int retval = 1; + + // bytes buffer + unsigned char buf[1024]; + + // random bytes + int rezval = RAND_bytes(buf, sizeof(buf)); /* 1 succes, 0 otherwise */ + + // check result + if(rezval == 1) + { + retval = 0; + } + + // return code + return retval; +} |