cmake: Rely on CURL::libcurl instead of CURL_LIBRARY
When calling find_package(CURL), different files might be inspected: - $CMAKE_PREFIX/Modules/FindCURL.cmake - 3rdParty/lib/cmake/CURL/CURLConfig.cmake Which file is selected is decided by CMake depending on the context. Unfortunately, whereas the former defines CURL_LIBRARY, the latter does not. However, both define the CURL::libcurl target, from which the library location can be retrieved with get_property() so as to achieve the same effect. Fixing this also makes CURL_NO_CURL_CMAKE redundant. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9582 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 470e785d15589e41bf6f5d1b3c42318bb5ef645e Former-commit-id: 5f8c279fc814833acdb26ade8979f67950033a8b
This commit is contained in:
parent
060bdf2a24
commit
2004f4ba0c
4 changed files with 11 additions and 9 deletions
|
@ -392,6 +392,7 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME)
|
|||
_FIND_3RDPARTY_DLL("${JPEG_LIBRARY}" "jpeg;jpeg-9;jpeg-8" "lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
get_property(CURL_LIBRARY TARGET CURL::libcurl PROPERTY LOCATION)
|
||||
_FIND_3RDPARTY_DLL("${CURL_LIBRARY}" "curl" "lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ MACRO(ADD_CURL_LIBRARY TARGET)
|
|||
FIND_PACKAGE(CURL)
|
||||
|
||||
IF(CURL_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${CURL_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(${TARGET} CURL::libcurl)
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find CURL libraries")
|
||||
ENDIF(CURL_FOUND)
|
||||
|
|
|
@ -71,12 +71,6 @@ if(CMAKE_SYSTEM_VERSION)
|
|||
list(APPEND EXTERNALS_CMAKE_ARGS "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
|
||||
endif()
|
||||
|
||||
# CMake's built-in FindCURL.cmake module doesn't set CURL_INCLUDE_DIR and CURL_LIBRARIES
|
||||
# if it finds CURLConfig.cmake it just returns after setting CURL_FOUND and CURL_DIR
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
list(APPEND EXTERNALS_CMAKE_ARGS -DCURL_NO_CURL_CMAKE=ON)
|
||||
endif()
|
||||
|
||||
list(APPEND EXTERNALS_CMAKE_ARGS "-D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||
list(APPEND EXTERNALS_CMAKE_ARGS "-D CMAKE_FIND_ROOT_PATH=${EXTERNALS_INSTALL_DIR}")
|
||||
list(APPEND EXTERNALS_CMAKE_ARGS "-D BUILD_SHARED_LIBS=ON")
|
||||
|
@ -550,6 +544,13 @@ if(OPTION_OSG)
|
|||
"<SOURCE_DIR>/src/osgViewer/GraphicsWindowWin32.cpp"
|
||||
DEPENDEES update # do after update
|
||||
DEPENDERS patch) # do before patch
|
||||
|
||||
ExternalProject_Add_Step(${OSG_PROJECT} osg_patch_curl_cmake
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_SOURCE_DIR}/patches/OpenSceneGraph-3.6.5/CMakeLists.txt"
|
||||
"<SOURCE_DIR>/src/osgPlugins/curl/CMakeLists.txt"
|
||||
DEPENDEES update # do after update
|
||||
DEPENDERS patch) # do before patch
|
||||
endif()
|
||||
|
||||
if(OPTION_GLM)
|
||||
|
|
|
@ -21,10 +21,10 @@ SET(TARGET_H
|
|||
ReaderWriterCURL.h
|
||||
)
|
||||
|
||||
IF(ZLIB_FOUND)
|
||||
IF(ZLIB_FOUND)
|
||||
SET(TARGET_LIBRARIES_VARS
|
||||
CURL_LIBRARY
|
||||
ZLIB_LIBRARIES)
|
||||
set(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} CURL::libcurl)
|
||||
ELSE()
|
||||
SET(TARGET_LIBRARIES_VARS
|
||||
CURL_LIBRARY)
|
||||
|
|
Loading…
Reference in a new issue