diff options
author | Brad King <brad.king@kitware.com> | 2018-03-08 14:56:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-03-08 14:56:40 (GMT) |
commit | 151763c9b2b5a1c76fc2acd31e284eca6940bded (patch) | |
tree | 1509217613300ba9fcc4e478b01d355782f88f95 /Tests | |
parent | f0b412dd82b8d45f1544961ecec618ebf877812d (diff) | |
parent | ee06f3c339e0f90e9a61891d3ad8c71a4286d504 (diff) | |
download | CMake-151763c9b2b5a1c76fc2acd31e284eca6940bded.zip CMake-151763c9b2b5a1c76fc2acd31e284eca6940bded.tar.gz CMake-151763c9b2b5a1c76fc2acd31e284eca6940bded.tar.bz2 |
Merge topic 'curl-target'
ee06f3c339 FindCURL: Revise documentation markup
83c0cb3f03 FindCURL: provide imported target CURL::CURL
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1822
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindCURL/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindCURL/Test/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/FindCURL/Test/main.c | 17 |
4 files changed, 47 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0ce6d72..f34bc04 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1326,6 +1326,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindBZip2) endif() + if(CMake_TEST_FindCURL) + add_subdirectory(FindCURL) + endif() + if(CMake_TEST_FindDoxygen) add_subdirectory(FindDoxygen) endif() diff --git a/Tests/FindCURL/CMakeLists.txt b/Tests/FindCURL/CMakeLists.txt new file mode 100644 index 0000000..0cfd629 --- /dev/null +++ b/Tests/FindCURL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindCURL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindCURL/Test" + "${CMake_BINARY_DIR}/Tests/FindCURL/Test" + ${build_generator_args} + --build-project TestFindCURL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindCURL/Test/CMakeLists.txt b/Tests/FindCURL/Test/CMakeLists.txt new file mode 100644 index 0000000..f0e5568 --- /dev/null +++ b/Tests/FindCURL/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindCURL C) +include(CTest) + +find_package(CURL REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_CURL_VERSION="${CURL_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt CURL::CURL) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${CURL_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${CURL_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindCURL/Test/main.c b/Tests/FindCURL/Test/main.c new file mode 100644 index 0000000..263775f --- /dev/null +++ b/Tests/FindCURL/Test/main.c @@ -0,0 +1,17 @@ +#include <curl/curl.h> +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + struct curl_slist* slist; + + curl_global_init(0); + + slist = curl_slist_append(NULL, "CMake"); + curl_slist_free_all(slist); + + curl_global_cleanup(); + + return 0; +} |