diff --git a/CMakeLists.txt b/CMakeLists.txt index 28c8450c9a..a36a9ac29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ else() option(BUILD_DEPS "Build all dependencies" OFF) endif() message(STATUS "Build all dependencies: ${BUILD_DEPS}") +# Install built dependencies if any, +option(INSTALL_BUILD_DEPS "Install build all dependencies" ON) # IF BUILD_DEPS=ON THEN Force all BUILD_*=ON include(CMakeDependentOption) diff --git a/cmake/cpp.cmake b/cmake/cpp.cmake index 87a20c02ec..69391fd20e 100644 --- a/cmake/cpp.cmake +++ b/cmake/cpp.cmake @@ -303,6 +303,26 @@ endif() # Install rules include(GNUInstallDirs) +# Install builded dependencies +if(INSTALL_BUILD_DEPS) + if( BUILD_ZLIB OR + BUILD_absl OR + BUILD_gflags OR + BUILD_glog OR + BUILD_Protobuf OR + BUILD_CoinUtils OR + BUILD_Osi OR + BUILD_Clp OR + BUILD_Cgl OR + BUILD_Cbc + ) + install( + DIRECTORY ${CMAKE_BINARY_DIR}/dependencies/install/ + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) + endif() +endif() + include(GenerateExportHeader) GENERATE_EXPORT_HEADER(${PROJECT_NAME}) install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_export.h