mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
52e42c2f74
This makes CMake look at the provided libraries before considering system libraries. Enable this by default on Windows. Fixes #830.
31 lines
867 B
CMake
31 lines
867 B
CMake
find_package(PkgConfig QUIET)
|
|
pkg_check_modules(PC_CURL libcurl)
|
|
set_extra_dirs(CURL curl)
|
|
|
|
find_path(CURL_INCLUDEDIR curl/curl.h
|
|
HINTS ${HINTS_CURL_INCLUDEDIR} ${PC_CURL_INCLUDEDIR} ${PC_CURL_INCLUDE_DIRS}
|
|
PATHS ${PATHS_CURL_INCLUDEDIR}
|
|
)
|
|
find_library(CURL_LIBRARY
|
|
NAMES curl
|
|
HINTS ${HINTS_CURL_LIBDIR} ${PC_CURL_LIBDIR} ${PC_CURL_LIBRARY_DIRS}
|
|
PATHS ${PATHS_CURL_LIBDIR}
|
|
)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(Curl DEFAULT_MSG CURL_LIBRARY CURL_INCLUDEDIR)
|
|
|
|
mark_as_advanced(CURL_LIBRARY CURL_INCLUDEDIR)
|
|
|
|
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
|
set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
|
|
|
|
string(FIND "${CURL_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
|
|
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
|
|
set(CURL_COPY_FILES
|
|
"${EXTRA_CURL_LIBDIR}/libcurl.dll"
|
|
)
|
|
else()
|
|
set(CURL_COPY_FILES)
|
|
endif()
|