@ -14,6 +14,11 @@
find_package ( Threads REQUIRED )
find_package ( Threads REQUIRED )
find_package ( PkgConfig QUIET )
find_package ( PkgConfig QUIET )
macro ( _detect_boost_components _outComponets librariesList )
string ( REGEX MATCHALL "boost_[a-z_]+[-a-z]*" _boost_libraries "${librariesList}" )
string ( REGEX REPLACE "boost_([a-z_]+)[-a-z]*" "\\1" ${ _outComponets } "${_boost_libraries}" )
endmacro ( )
if ( PKG_CONFIG_FOUND )
if ( PKG_CONFIG_FOUND )
pkg_check_modules ( PC_LIBTORRENT_RASTERBAR QUIET libtorrent-rasterbar )
pkg_check_modules ( PC_LIBTORRENT_RASTERBAR QUIET libtorrent-rasterbar )
endif ( )
endif ( )
@ -62,13 +67,34 @@ endif()
set ( LibtorrentRasterbar_LIBRARIES ${ LibtorrentRasterbar_LIBRARY } ${ CMAKE_THREAD_LIBS_INIT } )
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_CHRONO_FOUND OR NOT Boost_RANDOM_FOUND )
# W i t h o u t p k g - c o n f i g , w e c a n ' t p o s s i b l y f i g u r e o u t t h e c o r r e c t b o o s t d e p e n d e n c i e s
find_package ( Boost REQUIRED COMPONENTS date_time system chrono random thread )
if ( LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES )
set ( LibtorrentRasterbar_LIBRARIES
string ( REPLACE ";" " " _boost_components "${LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES}" )
$ { L i b t o r r e n t R a s t e r b a r _ L I B R A R I E S } $ { B o o s t _ L I B R A R I E S } $ { C M A K E _ T H R E A D _ L I B S _ I N I T } )
else ( LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES )
set ( LibtorrentRasterbar_INCLUDE_DIRS
if ( PC_LIBTORRENT_RASTERBAR_FOUND )
$ { L i b t o r r e n t R a s t e r b a r _ I N C L U D E _ D I R S } $ { B o o s t _ I N C L U D E _ D I R S } )
_detect_boost_components ( _boost_cmpnts "${PC_LIBTORRENT_RASTERBAR_LIBRARIES}" )
else ( )
# a l l p o s s i b l e b o o s t d e p e n d e n c i e s
set ( _boost_cmpnts
d a t e _ t i m e
s y s t e m
c h r o n o
r a n d o m
t h r e a d
)
endif ( )
endif ( )
list ( SORT _boost_cmpnts )
message ( STATUS "Libtorrent Boost dependencies: ${_boost_cmpnts}" )
string ( REPLACE ";" " " _boost_components "${_boost_cmpnts}" )
endif ( LibtorrentRasterbar_CUSTOM_BOOST_DEPENDENCIES )
find_package ( Boost REQUIRED COMPONENTS ${ _boost_components } )
set ( LibtorrentRasterbar_LIBRARIES ${ LibtorrentRasterbar_LIBRARIES } ${ CMAKE_THREAD_LIBS_INIT } )
foreach ( _boost_cmpnt IN LISTS _boost_components )
list ( APPEND LibtorrentRasterbar_LIBRARIES "Boost::${_boost_cmpnt}" )
endforeach ( _boost_cmpnt )
set ( LibtorrentRasterbar_INCLUDE_DIRS ${ LibtorrentRasterbar_INCLUDE_DIRS } ${ Boost_INCLUDE_DIRS } )
list ( FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX )
list ( FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX )
if ( LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1 )
if ( LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1 )
@ -83,10 +109,7 @@ include(FindPackageHandleStandardArgs)
# i f a l l l i s t e d v a r i a b l e s a r e T R U E
# i f a l l l i s t e d v a r i a b l e s a r e T R U E
find_package_handle_standard_args ( LibtorrentRasterbar DEFAULT_MSG
find_package_handle_standard_args ( LibtorrentRasterbar DEFAULT_MSG
L i b t o r r e n t R a s t e r b a r _ L I B R A R Y
L i b t o r r e n t R a s t e r b a r _ L I B R A R Y
L i b t o r r e n t R a s t e r b a r _ I N C L U D E _ D I R
L i b t o r r e n t R a s t e r b a r _ I N C L U D E _ D I R )
B o o s t _ S Y S T E M _ F O U N D
B o o s t _ C H R O N O _ F O U N D
B o o s t _ R A N D O M _ F O U N D )
mark_as_advanced ( LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
mark_as_advanced ( LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
L i b t o r r e n t R a s t e r b a r _ O R I G _ C M A K E _ F I N D _ L I B R A R Y _ S U F F I X E S
L i b t o r r e n t R a s t e r b a r _ O R I G _ C M A K E _ F I N D _ L I B R A R Y _ S U F F I X E S