forked from premiere/premiere-libtorrent
cmake: build examples in the same solution as libtorrent
Keep the search script for reference
This commit is contained in:
parent
d250ba5a17
commit
626ce25225
|
@ -181,6 +181,7 @@ option(exceptions "build with exception support" ON)
|
|||
option(libiconv "enable linking against system libiconv" OFF)
|
||||
option(logging "build with logging" ON)
|
||||
option(build_tests "build tests" OFF)
|
||||
option(build_examples "build examples" OFF)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
|
@ -408,10 +409,10 @@ install(
|
|||
${ConfigPackageLocation}
|
||||
)
|
||||
|
||||
# === set up examples directory as an independent project ===
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples)
|
||||
configure_file(examples/run_cmake.sh.in examples/run_cmake.sh)
|
||||
# to build the examples, run examples/run_cmake.sh after building libtorrent
|
||||
# === build examples ===
|
||||
if (build_examples)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
# === build tests ===
|
||||
if(build_tests)
|
||||
|
|
|
@ -1,26 +1,5 @@
|
|||
project(libtorrent-examples)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
|
||||
# Add extra include and library search directories so examples can optionally
|
||||
# be built without a prior "make install" of libtorrent.
|
||||
list(INSERT CMAKE_INCLUDE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/../include")
|
||||
list(INSERT CMAKE_LIBRARY_PATH 0 "${CMAKE_CURRENT_BINARY_DIR}/..")
|
||||
|
||||
# Also use the generated pkg-config file prior to "make install".
|
||||
# In an independent project, these lines would simply not exist.
|
||||
set(PKG_CONFIG_CHANGED_PATH "${CMAKE_CURRENT_BINARY_DIR}/..;$ENV{PKG_CONFIG_PATH}")
|
||||
if(UNIX)
|
||||
string(REPLACE ";" ":" PKG_CONFIG_CHANGED_PATH "${PKG_CONFIG_CHANGED_PATH}")
|
||||
endif ()
|
||||
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_CHANGED_PATH}")
|
||||
|
||||
find_package(LibtorrentRasterbar REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS system)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
include_directories(${LibtorrentRasterbar_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
|
||||
add_definitions(${LibtorrentRasterbar_DEFINITIONS})
|
||||
|
||||
set(single_file_examples
|
||||
simple_client
|
||||
|
@ -32,7 +11,7 @@ set(single_file_examples
|
|||
|
||||
foreach(example ${single_file_examples})
|
||||
add_executable(${example} "${example}.cpp")
|
||||
target_link_libraries(${example} ${LibtorrentRasterbar_LIBRARIES} ${Boost_LIBRARIES})
|
||||
target_link_libraries(${example} torrent-rasterbar)
|
||||
endforeach(example)
|
||||
|
||||
add_executable(client_test
|
||||
|
@ -40,4 +19,4 @@ add_executable(client_test
|
|||
print.cpp
|
||||
torrent_view.cpp
|
||||
session_view.cpp)
|
||||
target_link_libraries(client_test ${LibtorrentRasterbar_LIBRARIES} ${Boost_LIBRARIES})
|
||||
target_link_libraries(client_test torrent-rasterbar)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd ${libtorrent_BINARY_DIR}/examples
|
||||
cmake \
|
||||
-G "${CMAKE_GENERATOR}" \
|
||||
$@ \
|
||||
${libtorrent_SOURCE_DIR}/examples
|
Loading…
Reference in New Issue