I have written a simple c++ program which use boost that I want to deploy on machines of same architecture with any linux flavor (for the time being) that may or may not have some boost versions installed. I'm new to deployment but tried to read docs and come up with a CMakeLists.txt which looks like :
cmake_minimum_required(VERSION 2.8)
project( myprog )
FIND_PACKAGE( Boost 1.50 COMPONENTS thread system chrono program_options REQUIRED )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
add_executable( myprog myprog.cpp )
target_link_libraries( myprog -lpthread -lboost_system -lboost_chrono -lboost_program_options )
INSTALL( TARGETS myprog DESTINATION . )
SET( CPACK_GENERATOR "TGZ")
INCLUDE( CPack )
Everything compile and run fine, but packaging (make package) only package the executable and not the dependent boost libraries ".so"
When I run : ldd myprog it tells me it depends on : linux-vdso.so, libpthread.so, libboost_system.so, libboost_chrono.so, libboost_program_options.so libstdc++.so libgcc_s.so libc.so librt.so libm.so
Those are the shared libraries I want to pack (maybe I don't need to pack the standard ones)
How can I tell cmake to grab the correct shared object libraries, and put them next to the executable so that the user only has to untar the folder and launch executable without any installation ?
Static linking is not an option here as I will have a bunch of executables that will use the same boost libraries, and there may also be some license issues with statically linking against libgcc.