set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(LIBCURL_LIBS "")
set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # For processing full path libraries into -L and -l ld options,
+ # the directories that go with the -L option are cached, so they
+ # only get added once per such directory.
+ set(_libcurl_libs_dirs)
+ # To avoid getting unnecessary -L options for known system directories,
+ # _libcurl_libs_dirs is seeded with them.
+ foreach(_libdir ${CMAKE_SYSTEM_PREFIX_PATH})
+ if(_libdir MATCHES "/$")
+ set(_libdir "${_libdir}lib")
+ else()
+ set(_libdir "${_libdir}/lib")
+ endif()
+ if(IS_DIRECTORY "${_libdir}")
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ endif()
+ if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
+ set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
+ if(IS_DIRECTORY "${_libdir}")
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ endif()
+ endif()
+ endforeach()
+
foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
if(TARGET "${_lib}")
set(_libname "${_lib}")
continue()
endif()
endif()
- if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-")
+ if(_lib MATCHES "^-")
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
+ elseif(_lib MATCHES ".*/.*")
+ # This gets a bit more complex, because we want to specify the
+ # directory separately, and only once per directory
+ string(REGEX REPLACE "^(.*)/[^/]*$" "\\1" _libdir "${_lib}")
+ string(REGEX REPLACE "^.*/([^/.]*).*$" "\\1" _libname "${_lib}")
+ if(_libname MATCHES "^lib")
+ list(FIND _libcurl_libs_dirs "${_libdir}" _libdir_index)
+ if(_libdir_index LESS 0)
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} -L${_libdir}")
+ endif()
+ string(REGEX REPLACE "^lib" "" _libname "${_libname}")
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_libname}")
+ else()
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
+ endif()
else()
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}")
endif()
15.3 unusable tool_hugehelp.c with MinGW
15.6 uses -lpthread instead of Threads::Threads
15.7 generated .pc file contains strange entries
- 15.8 libcurl.pc uses absolute library paths
15.11 ExternalProject_Add does not set CURL_CA_PATH
15.13 CMake build with MIT Kerberos does not work
See https://github.com/curl/curl/issues/6167
-15.8 libcurl.pc uses absolute library paths
-
- The libcurl.pc file generated by cmake contains things like Libs.private:
- /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so. The
- autotools equivalent would say Libs.private: -lssl -lcrypto -lz
-
- See https://github.com/curl/curl/issues/6169
-
15.11 ExternalProject_Add does not set CURL_CA_PATH
CURL_CA_BUNDLE and CURL_CA_PATH are not set properly when cmake's