diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2018-03-05 21:17:28 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2018-03-06 21:53:35 (GMT) |
commit | 83c0cb3f0328504baf425704803c2ae83942cb86 (patch) | |
tree | fbaab31be56b074c2f05bbc4d1fef6b172c63e0a /Tests/FindCURL | |
parent | 674c5b306671129bc4a854137c304f19e2c3bf65 (diff) | |
download | CMake-83c0cb3f0328504baf425704803c2ae83942cb86.zip CMake-83c0cb3f0328504baf425704803c2ae83942cb86.tar.gz CMake-83c0cb3f0328504baf425704803c2ae83942cb86.tar.bz2 |
FindCURL: provide imported target CURL::CURL
Diffstat (limited to 'Tests/FindCURL')
-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 |
3 files changed, 43 insertions, 0 deletions
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; +} |