summaryrefslogtreecommitdiffstats
path: root/Modules/FindCURL.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindCURL.cmake')
-rw-r--r--Modules/FindCURL.cmake34
1 files changed, 27 insertions, 7 deletions
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index f4bcc36..e66ae92 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -5,16 +5,30 @@
# FindCURL
# --------
#
-# Find curl
-#
# Find the native CURL headers and libraries.
#
-# ::
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if
+# curl has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables:
#
-# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
-# CURL_LIBRARIES - List of libraries when using curl.
-# CURL_FOUND - True if curl found.
-# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
+# ``CURL_FOUND``
+# True if curl found.
+#
+# ``CURL_INCLUDE_DIRS``
+# where to find curl/curl.h, etc.
+#
+# ``CURL_LIBRARIES``
+# List of libraries when using curl.
+#
+# ``CURL_VERSION_STRING``
+# The version of curl found.
# Look for the header file.
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
@@ -52,4 +66,10 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
if(CURL_FOUND)
set(CURL_LIBRARIES ${CURL_LIBRARY})
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
+
+ if(NOT TARGET CURL::CURL)
+ add_library(CURL::CURL UNKNOWN IMPORTED)
+ set_target_properties(CURL::CURL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
+ set_property(TARGET CURL::CURL APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}")
+ endif()
endif()