From 478b03eeec2aeec5b9d85ed78a1c60712bd4da34 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 23 May 2024 18:46:03 +0100 Subject: [PATCH] Use CURL::libcurl target if available If curl's found via CMake config instead of the finder script, it might not set CURL_LIBRARIES. There's no need to specify CURL_INCLUDE_DIR explicitly if the libcurl target is used as it sets it up implicitly. --- src/curl/build_vars.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/curl/build_vars.cmake b/src/curl/build_vars.cmake index 015b68c..3f8206d 100644 --- a/src/curl/build_vars.cmake +++ b/src/curl/build_vars.cmake @@ -9,8 +9,12 @@ if(${vsgXchange_curl}) set(SOURCES ${SOURCES} curl/curl.cpp ) - set(EXTRA_INCLUDES ${EXTRA_INCLUDES} ${CURL_INCLUDE_DIR}) - set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${CURL_LIBRARIES}) + if(TARGET CURL::libcurl) + set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} CURL::libcurl) + else() + set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${CURL_LIBRARIES}) + set(EXTRA_INCLUDES ${EXTRA_INCLUDES} ${CURL_INCLUDE_DIR}) + endif() if(NOT BUILD_SHARED_LIBS) set(FIND_DEPENDENCY ${FIND_DEPENDENCY} "find_dependency(CURL)") endif()