mirror of
https://github.com/transmission/transmission.git
synced 2026-04-02 00:27:38 +01:00
* build: overhaul tr_add_external_auto_library * build: use package-provided CMake config file libevent * build: use package-provided CMake config file miniupnpc * build: update libutp find module * build: make LIBNAME an optional parameter * build: use package-provided CMake config file libdeflate * build: update libb64 find module * build: update libnatpmp find module * build: update libpsl find module * build: support system fast_float library * chore: reformat long brew commands * build: support system fmt library * build: support system rapidjson library * build: support system small library * build: support system library utf8cpp * build: support system library WideInteger * build: support system library gtest * fix: incorrectly labeled test suites * build: remove unused parameters from tr_add_external_auto_library * build: update crc32c cmake script * fix: dht system library * fix: add libutp interface target * code review: move TrGtest.cmake * code review: move tr_get_fmt_version into Findfmt.cmake * code review: use option() for gtest * code review: move find_package(PkgConfig) out of loop * build: delete FindCrc32c.cmake Impossible to parse package version from distributed source files. * code review: Finddht.cmake * build: delete FindFastFloat.cmake Impossible to parse package version from distributed source files. * code review: Findfmt.cmake * code review: Findlibb64.cmake * code review: Findlibdeflate.cmake * code review: Findlibevent.cmake * code review: Findlibnatpmp.cmake * code review: Findlibpsl.cmake * code review: Findlibutp.cmake * code review: Findlibminiupnpc.cmake * code review: FindRapidJSON.cmake * build: delete FindSmall.cmake Impossible to parse package version from distributed source files. * build: only accept cmake config package for utf8cpp Impossible to parse package version from distributed source files. * build: delete FindWideInteger.cmake Impossible to parse package version from distributed source files. * build: add `USE_SYSTEM_DEFAULT` * ci: drop Fedora 40 and adopt Fedora 43 * ci: try to silence system header warnings * ci: use `cmake --install` * Revert "build: only accept cmake config package for utf8cpp" This reverts commit2158d631fd. * build: harden utf8cpp find module * chore: bump wide-integer Pick upbf9398f9daandbcc726a30f* refactor: gtest should be included with angled brackets Now that gtest is built as a system library, it should be included with angled brackets instead of quotes. * code review: fixup libutp variables before `find_package_handle_standard_args` * code review: define `WIDE_INTEGER_HAS_LIMB_TYPE_UINT64` only for targets depending on WideInteger * chore: bump wide-integer Pickup4b2258acacso that wide-integer tests won't run in Transmission project.
95 lines
3.1 KiB
CMake
95 lines
3.1 KiB
CMake
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
if(WIN32)
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
else()
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
endif()
|
|
endif()
|
|
|
|
if(UNIX)
|
|
find_package(PkgConfig QUIET)
|
|
pkg_check_modules(_UTP QUIET libutp)
|
|
endif()
|
|
|
|
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
|
NAMES libutp/utp.h
|
|
HINTS ${_UTP_INCLUDEDIR})
|
|
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
|
NAMES utp
|
|
HINTS ${_UTP_LIBDIR})
|
|
|
|
include(CheckCXXSymbolExists)
|
|
|
|
set(_UTP_FUNCS
|
|
utp_check_timeouts
|
|
utp_close
|
|
utp_connect
|
|
utp_context_get_userdata
|
|
utp_context_set_option
|
|
utp_context_set_userdata
|
|
utp_create_socket
|
|
utp_destroy
|
|
utp_getpeername
|
|
utp_get_userdata
|
|
utp_init
|
|
utp_issue_deferred_acks
|
|
utp_process_udp
|
|
utp_read_drained
|
|
utp_set_callback
|
|
utp_set_userdata
|
|
utp_write
|
|
utp_writev)
|
|
|
|
set(_UTP_OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
|
|
set(_UTP_OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
|
set(_UTP_OLD_CMAKE_REQUIRED_QUIET "${CMAKE_REQUIRED_QUIET}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}")
|
|
set(CMAKE_REQUIRED_LIBRARIES "${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY}")
|
|
set(CMAKE_REQUIRED_QUIET ON)
|
|
|
|
foreach(_UTP_FUNC IN LISTS _UTP_FUNCS)
|
|
string(MAKE_C_IDENTIFIER "HAVE_${_UTP_FUNC}" _UTP_FUNC_VAR)
|
|
string(TOUPPER "${_UTP_FUNC_VAR}" _UTP_FUNC_VAR)
|
|
check_cxx_symbol_exists(${_UTP_FUNC} libutp/utp.h ${_UTP_FUNC_VAR})
|
|
if(NOT ${_UTP_FUNC_VAR})
|
|
unset(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR CACHE)
|
|
unset(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY CACHE)
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${_UTP_OLD_CMAKE_REQUIRED_INCLUDES}")
|
|
set(CMAKE_REQUIRED_LIBRARIES "${_UTP_OLD_CMAKE_REQUIRED_LIBRARIES}")
|
|
set(CMAKE_REQUIRED_QUIET "${_UTP_OLD_CMAKE_REQUIRED_QUIET}")
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
|
REQUIRED_VARS
|
|
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
|
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
|
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
|
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
|
|
|
if(NOT TARGET libutp::libutp)
|
|
add_library(libutp::libutp INTERFACE IMPORTED)
|
|
target_include_directories(libutp::libutp
|
|
INTERFACE
|
|
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
|
target_link_libraries(libutp::libutp
|
|
INTERFACE
|
|
${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
|
endif()
|
|
endif()
|
|
|
|
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
|
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
|
endif()
|