Skip to content

Commit 25827f6

Browse files
authored
CMake: allow use of installed dependencies, take 2 (#337)
* CMake: allow use of installed pybind11 * CMake: modernize cereal use * changelog: sync
1 parent 808e4bf commit 25827f6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
## [Unreleased]
88

99
### Added
10-
* Allow use of installed cereal and jrl-cmakemodules via cmake
10+
* Allow use of installed pybind11, cereal and jrl-cmakemodules via cmake
1111
* Add compatibility with jrl-cmakemodules workspace ([#339](https://github.com/Simple-Robotics/proxsuite/pull/339))
1212
* Specifically mention that timings are in microseconds ([#340](https://github.com/Simple-Robotics/proxsuite/pull/340))
1313
* Fix cereal include directory in cmake ([#340](https://github.com/Simple-Robotics/proxsuite/pull/340))

bindings/python/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ else()
1414
${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
1515
endif()
1616

17-
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external/pybind11)
18-
add_subdirectory(external/pybind11
19-
${CMAKE_CURRENT_BINARY_DIR}/external/pybind11)
17+
find_package(pybind11 CONFIG)
18+
if(NOT pybind11_FOUND)
19+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external/pybind11)
20+
add_subdirectory(external/pybind11
21+
${CMAKE_CURRENT_BINARY_DIR}/external/pybind11)
22+
endif()
2023

2124
add_custom_target(${PROJECT_NAME}_python)
2225

@@ -92,8 +95,7 @@ function(CREATE_PYTHON_TARGET target_name COMPILE_OPTIONS dependencies)
9295
endif(BUILD_WITH_OPENMP_SUPPORT)
9396

9497
if(cereal_FOUND)
95-
target_include_directories(${target_name} SYSTEM
96-
PRIVATE ${CEREAL_INCLUDE_DIRS})
98+
target_link_libraries(${target_name} PRIVATE cereal::cereal)
9799
else()
98100
target_include_directories(
99101
${target_name} SYSTEM

0 commit comments

Comments
 (0)