2017-09-10 10:56:16 -04:00
|
|
|
|
|
|
|
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
|
|
|
|
|
|
if(NOT CURL_FIND_COMPONENTS)
|
2018-07-17 02:36:59 -04:00
|
|
|
set(CURL_FIND_COMPONENTS curl libcurl)
|
|
|
|
if(CURL_FIND_REQUIRED)
|
|
|
|
set(CURL_FIND_REQUIRED_curl TRUE)
|
|
|
|
set(CURL_FIND_REQUIRED_libcurl TRUE)
|
|
|
|
endif()
|
2017-09-10 10:56:16 -04:00
|
|
|
endif()
|
|
|
|
|
2018-09-15 19:15:08 -04:00
|
|
|
if("@USE_OPENSSL@")
|
|
|
|
include(CMakeFindDependencyMacro)
|
2018-07-17 04:13:18 -04:00
|
|
|
find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@")
|
|
|
|
endif()
|
|
|
|
|
2017-09-10 10:56:16 -04:00
|
|
|
set(_curl_missing_components)
|
|
|
|
foreach(_comp ${CURL_FIND_COMPONENTS})
|
2018-07-17 02:36:59 -04:00
|
|
|
if(EXISTS "${_DIR}/${_comp}-target.cmake")
|
|
|
|
include("${_DIR}/${_comp}-target.cmake")
|
|
|
|
set(CURL_${_comp}_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(CURL_${_comp}_FOUND FALSE)
|
|
|
|
if(CURL_FIND_REQUIRED_${_comp})
|
|
|
|
set(CURL_FOUND FALSE)
|
|
|
|
list(APPEND _curl_missing_components ${_comp})
|
2017-09-10 10:56:16 -04:00
|
|
|
endif()
|
2018-07-17 02:36:59 -04:00
|
|
|
endif()
|
2017-09-10 10:56:16 -04:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(_curl_missing_components)
|
2018-07-17 02:36:59 -04:00
|
|
|
set(CURL_NOT_FOUND_MESSAGE "Following required components not found: " ${_curl_missing_components})
|
2017-09-10 10:56:16 -04:00
|
|
|
else()
|
2018-07-17 02:36:59 -04:00
|
|
|
if(TARGET CURL::libcurl)
|
|
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" _curl_current_config)
|
|
|
|
if(NOT _curl_current_config)
|
|
|
|
set(_curl_current_config "NOCONFIG")
|
|
|
|
endif()
|
|
|
|
get_target_property(_curl_configurations CURL::libcurl IMPORTED_CONFIGURATIONS)
|
|
|
|
list(FIND _curl_configurations "${_curl_current_config}" _i)
|
|
|
|
if(_i LESS 0)
|
|
|
|
set(_curl_config "RELEASE")
|
|
|
|
list(FIND _curl_configurations "${_curl_current_config}" _i)
|
|
|
|
if(_i LESS 0)
|
|
|
|
set(_curl_config "NOCONFIG")
|
2017-09-10 10:56:16 -04:00
|
|
|
list(FIND _curl_configurations "${_curl_current_config}" _i)
|
2018-07-17 02:36:59 -04:00
|
|
|
endif()
|
|
|
|
endif()
|
2017-09-10 10:56:16 -04:00
|
|
|
|
2018-07-17 02:36:59 -04:00
|
|
|
if(_i LESS 0)
|
|
|
|
set(_curl_current_config "") # let CMake pick config at random
|
|
|
|
else()
|
|
|
|
set(_curl_current_config "_${_curl_current_config}")
|
2017-09-10 10:56:16 -04:00
|
|
|
endif()
|
2018-07-17 02:36:59 -04:00
|
|
|
|
|
|
|
get_target_property(CURL_INCLUDE_DIRS CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
|
get_target_property(CURL_LIBRARIES CURL::libcurl "LOCATION${_curl_current_config}")
|
|
|
|
set(_curl_current_config)
|
|
|
|
set(_curl_configurations)
|
|
|
|
set(_i)
|
|
|
|
endif()
|
2017-09-10 10:56:16 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_curl_missing_components)
|