Files
transmission/cmake/FindCRC32C.cmake
Yat Ho 0715897fc8 feat: use canonical peer priority to decide which peers to keep (#6981)
* feat: CRC32-C

* feat: canonical peer priority calculation bep-40

* test: add test cases for IPv4 canonical peer priority

* refactor: compare by canonical priority

* fix: use network byte order for peer ports

* test: more cases

* build: xcode

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* ci: test system crc32c library

---------

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2025-10-25 12:05:20 -05:00

31 lines
873 B
CMake

if(CRC32C_PREFER_STATIC_LIB)
set(CRC32C_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()
find_path(CRC32C_INCLUDE_DIR
NAMES crc32c/crc32c.h)
find_library(CRC32C_LIBRARY
NAMES crc32c)
set(CRC32C_INCLUDE_DIRS ${CRC32C_INCLUDE_DIR})
set(CRC32C_LIBRARIES ${CRC32C_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CRC32C
REQUIRED_VARS
CRC32C_INCLUDE_DIR
CRC32C_LIBRARY)
mark_as_advanced(CRC32C_INCLUDE_DIR CRC32C_LIBRARY)
if(CRC32C_PREFER_STATIC_LIB)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CRC32C_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
unset(CRC32C_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
endif()