forked from premiere/premiere-libtorrent
CMake build: Require Boost.Random from FindLibtorrentRasterbar.
Also remove outdated requirements for Boost.Thread and Boost.DateTime linking.
This commit is contained in:
parent
4a5c6ec733
commit
a699cfae7e
|
@ -181,6 +181,8 @@ if (build_tests)
|
||||||
add_definitions(-DTORRENT_EXPORT_EXTRA)
|
add_definitions(-DTORRENT_EXPORT_EXTRA)
|
||||||
endif (build_tests)
|
endif (build_tests)
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
include_directories(${includes})
|
include_directories(${includes})
|
||||||
|
|
||||||
add_definitions(-DTORRENT_BUILDING_LIBRARY)
|
add_definitions(-DTORRENT_BUILDING_LIBRARY)
|
||||||
|
@ -245,16 +247,16 @@ endif()
|
||||||
|
|
||||||
# Boost
|
# Boost
|
||||||
if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES)
|
if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES)
|
||||||
FIND_PACKAGE( Boost COMPONENTS system thread date_time chrono random)
|
FIND_PACKAGE(Boost REQUIRED COMPONENTS system chrono random)
|
||||||
endif()
|
endif()
|
||||||
include_directories(${Boost_INCLUDE_DIR})
|
include_directories(${Boost_INCLUDE_DIR})
|
||||||
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES})
|
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
# this works around a bug in asio in boost-1.39
|
# this works around a bug in asio in boost-1.39
|
||||||
#add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN )
|
#add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN )
|
||||||
|
|
||||||
if(NOT static_runtime)
|
if(NOT static_runtime)
|
||||||
add_definitions(-DBOOST_ASIO_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_THREAD_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK)
|
add_definitions(-DBOOST_ASIO_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_RANDOM_DYN_LINK)
|
||||||
else()
|
else()
|
||||||
add_definitions(-DBOOST_ASIO_SEPARATE_COMPILATION)
|
add_definitions(-DBOOST_ASIO_SEPARATE_COMPILATION)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# LibtorrentRasterbar_DEFINITIONS - Compiler switches required for using libtorrent-rasterbar
|
# LibtorrentRasterbar_DEFINITIONS - Compiler switches required for using libtorrent-rasterbar
|
||||||
# LibtorrentRasterbar_OPENSSL_ENABLED - libtorrent-rasterbar uses and links against OpenSSL
|
# LibtorrentRasterbar_OPENSSL_ENABLED - libtorrent-rasterbar uses and links against OpenSSL
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
|
|
||||||
if(PKG_CONFIG_FOUND)
|
if(PKG_CONFIG_FOUND)
|
||||||
|
@ -43,7 +44,6 @@ else()
|
||||||
else()
|
else()
|
||||||
list(APPEND LibtorrentRasterbar_DEFINITIONS
|
list(APPEND LibtorrentRasterbar_DEFINITIONS
|
||||||
-DTORRENT_LINKING_SHARED -DBOOST_ASIO_DYN_LINK
|
-DTORRENT_LINKING_SHARED -DBOOST_ASIO_DYN_LINK
|
||||||
-DBOOST_DATE_TIME_DYN_LINK -DBOOST_THREAD_DYN_LINK
|
|
||||||
-DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK)
|
-DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -61,13 +61,15 @@ if(LibtorrentRasterbar_USE_STATIC_LIBS)
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARY})
|
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIR})
|
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIR})
|
||||||
|
|
||||||
if(NOT Boost_SYSTEM_FOUND OR NOT Boost_THREAD_FOUND OR NOT Boost_DATE_TIME_FOUND OR NOT Boost_CHRONO_FOUND)
|
if(NOT Boost_SYSTEM_FOUND OR NOT Boost_CHRONO_FOUND OR NOT Boost_RANDOM_FOUND)
|
||||||
find_package(Boost REQUIRED COMPONENTS system thread date_time chrono)
|
find_package(Boost REQUIRED COMPONENTS system chrono random)
|
||||||
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} ${Boost_LIBRARIES})
|
set(LibtorrentRasterbar_LIBRARIES
|
||||||
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
|
${LibtorrentRasterbar_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
set(LibtorrentRasterbar_INCLUDE_DIRS
|
||||||
|
${LibtorrentRasterbar_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX)
|
list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX)
|
||||||
|
@ -85,9 +87,8 @@ find_package_handle_standard_args(LibtorrentRasterbar DEFAULT_MSG
|
||||||
LibtorrentRasterbar_LIBRARY
|
LibtorrentRasterbar_LIBRARY
|
||||||
LibtorrentRasterbar_INCLUDE_DIR
|
LibtorrentRasterbar_INCLUDE_DIR
|
||||||
Boost_SYSTEM_FOUND
|
Boost_SYSTEM_FOUND
|
||||||
Boost_THREAD_FOUND
|
Boost_CHRONO_FOUND
|
||||||
Boost_DATE_TIME_FOUND
|
Boost_RANDOM_FOUND)
|
||||||
Boost_CHRONO_FOUND)
|
|
||||||
|
|
||||||
mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
|
mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
|
||||||
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
||||||
|
|
Loading…
Reference in New Issue