Skip to content

Commit

Permalink
Add USE_SYSTEM_tiny-process-library CMake option to use tiny-process-…
Browse files Browse the repository at this point in the history
…library found in system (#891)
  • Loading branch information
traversaro authored Sep 23, 2024
1 parent 0ee61e7 commit 392b02b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to this project are documented in this file.

## [unreleased]
### Added
- Add `USE_SYSTEM_tiny-process-library` CMake option to use `tiny-process-library` found in system (https://github.com/ami-iit/bipedal-locomotion-framework/pull/891)

### Changed

Expand Down
43 changes: 23 additions & 20 deletions devices/YarpRobotLoggerDevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@
# BSD-3-Clause license.

if(FRAMEWORK_COMPILE_YarpRobotLoggerDevice)
# Warning: the <package> option of yarp_configure_plugins_installation should be different from the plugin name

option(USE_SYSTEM_tiny-process-library "Use system tiny-process-library" OFF)

include(FetchContent)
FetchContent_Declare(tiny_process_library
GIT_REPOSITORY https://gitlab.com/eidheim/tiny-process-library.git
GIT_TAG v2.0.4)
if(USE_SYSTEM_tiny-process-library)
find_package(tiny-process-library REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(tiny_process_library
GIT_REPOSITORY https://gitlab.com/eidheim/tiny-process-library.git
GIT_TAG v2.0.4)

if(NOT tiny_process_library_POPULATED)
FetchContent_Populate(tiny_process_library)
if(NOT tiny_process_library_POPULATED)
FetchContent_Populate(tiny_process_library)

set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build libraries as shared as opposed to static")
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build libraries as shared as opposed to static")

set(BUILD_TESTING_OLD ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE INTERNAL "Create tests using CMake")
set(BUILD_TESTING_OLD ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE INTERNAL "Create tests using CMake")

# Bring the populated content into the build
add_subdirectory(${tiny_process_library_SOURCE_DIR} ${tiny_process_library_BINARY_DIR})
# Bring the populated content into the build
add_subdirectory(${tiny_process_library_SOURCE_DIR} ${tiny_process_library_BINARY_DIR})

# Restore the old value of the parameter
set(BUILD_TESTING ${BUILD_TESTING_OLD} CACHE BOOL
"Create tests using CMake" FORCE)
# Restore the old value of the parameter
set(BUILD_TESTING ${BUILD_TESTING_OLD} CACHE BOOL
"Create tests using CMake" FORCE)

set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE BOOL
"Build libraries as shared as opposed to static" FORCE)
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE BOOL
"Build libraries as shared as opposed to static" FORCE)
endif()
endif()


# Warning: the <package> option of yarp_configure_plugins_installation should be different from the plugin name
add_bipedal_yarp_device(
NAME YarpRobotLoggerDevice
TYPE BipedalLocomotion::YarpRobotLoggerDevice
Expand Down

0 comments on commit 392b02b

Please sign in to comment.