diff options
author | Brad King <brad.king@kitware.com> | 2019-09-19 13:31:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-09-19 13:32:02 (GMT) |
commit | 98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82 (patch) | |
tree | 66fb5b2f6a0123eed4a066c6b4598b839c6d385e /Tests | |
parent | 0772d15c2ce5bfd95a87894ee5226d6d74fcff41 (diff) | |
parent | 44e8b8f1f222c0227ed72d09310e30524bda9935 (diff) | |
download | CMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.zip CMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.tar.gz CMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.tar.bz2 |
Merge topic 'FindGnuTLS-target'
44e8b8f1f2 FindGnuTLS: add target GnuTLS::GnuTLS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3825
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/FindGnuTLS/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindGnuTLS/Test/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/FindGnuTLS/Test/main.c | 22 |
4 files changed, 50 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c14107a..78ae7aa 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1394,6 +1394,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH GIF Git GLEW + GnuTLS GSL GTK2 Iconv diff --git a/Tests/FindGnuTLS/CMakeLists.txt b/Tests/FindGnuTLS/CMakeLists.txt new file mode 100644 index 0000000..059ac7b --- /dev/null +++ b/Tests/FindGnuTLS/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindGnuTLS.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGnuTLS/Test" + "${CMake_BINARY_DIR}/Tests/FindGnuTLS/Test" + ${build_generator_args} + --build-project TestFindGnuTLS + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindGnuTLS/Test/CMakeLists.txt b/Tests/FindGnuTLS/Test/CMakeLists.txt new file mode 100644 index 0000000..c5a9819 --- /dev/null +++ b/Tests/FindGnuTLS/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindGnuTLS C) +include(CTest) + +find_package(GnuTLS REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_GNUTLS_VERSION="${GNUTLS_VERSION}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt GnuTLS::GnuTLS) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${GNUTLS_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${GNUTLS_LIBRARIES}) +target_compile_definitions(test_var PRIVATE ${GNUTLS_DEFINITIONS}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindGnuTLS/Test/main.c b/Tests/FindGnuTLS/Test/main.c new file mode 100644 index 0000000..122fb2d --- /dev/null +++ b/Tests/FindGnuTLS/Test/main.c @@ -0,0 +1,22 @@ +#include <assert.h> +#include <stdio.h> +#include <string.h> + +#include <gnutls/gnutls.h> + +int main() +{ + // test the linker + gnutls_session_t session; + if (gnutls_init(&session, GNUTLS_CLIENT)) { + gnutls_deinit(session); + } + + // check the version + char gnutls_version_string[16]; + snprintf(gnutls_version_string, 16, "%i.%i.%i", GNUTLS_VERSION_MAJOR, + GNUTLS_VERSION_MINOR, GNUTLS_VERSION_PATCH); + assert(strcmp(gnutls_version_string, CMAKE_EXPECTED_GNUTLS_VERSION) == 0); + + return 0; +} |