I am trying to install an executable using cmake. My real problem here is: how to install the executable and its dependencies.
Here is an example: I want to install one executable, which depends on two libraries of my cmake and one 3rd party (pre-compiled).
set(EXECUTABLE_NAME MyExecutable)
file(GLOB_RECURSE ${EXECUTABLE_NAME}_SOURCES *.cpp)
add_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
target_link_libraries(${EXECUTABLE_NAME} MyLibrary1
MyLibrary2
${Boost_PROGRAM_OPTIONS_LIBRARY})
install(TARGETS ${EXECUTABLE_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
COMPONENT ${EXECUTABLE_NAME})
In the end, I would like to find my two libraries with this kind of CMakeLists.txt, my executable file and Boost_PROGRAM_OPTIONS_LIBRARY in the installation folder and in my package.
What I found but failed to use:
BundleUtilities.cmake, : https://cmake.org/Wiki/BundleUtilitiesExample. , , , , " ". , , . (: , .: https://cmake.org/cmake/help/v3.5/module/BundleUtilities.html)
GetPrerequisites.cmake. get_prerequisites - , . , / .
,