Skip to content

Commit

Permalink
Merge pull request #642 from robotology/fix-missing-find-dep-in-static
Browse files Browse the repository at this point in the history
Make sure that private dependencies are correctly found in iDynTreeConfig.cmake when compiling as a static library
  • Loading branch information
traversaro authored Jan 26, 2020
2 parents 97d5d89 + 3baf020 commit 50d6d03
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Remove spurious inclusion of Eigen headers in ExtendedKalmanFilter.h public header, that could create probles when using that header in a downstream project that does not use Eigen (https://github.com/robotology/idyntree/pull/639).
- Added find_dependency(OsqpEigen) and find_dependency(LibXml2) when iDynTree is compiled as a static library, fixing the use of iDynTree on Windows (https://github.com/robotology/idyntree/pull/642).

### Changed
- To reduce the possible unexpected problems, the automatic set of the `IDYNTREE_USES_<pkg>` CMake variable when the `<pkg>` CMake package is available in the system has been removed for Irrlicht and WORHP, as it was already disabled for ASSIMP and ALGLIB (https://github.com/robotology/idyntree/pull/642). To use this dependencies it is now compulsory to set manually the `IDYNTREE_USES_<pkg>` variable to `ON`.

## [1.0.1] - 2020-01-14

Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if(NOT IDYNTREE_ONLY_DOCS)
# add the actual components of the library
add_subdirectory(src)

# List exported dependencies
# List exported CMake package dependencies
set(_IDYNTREE_EXPORTED_DEPENDENCIES "")
if(IDYNTREE_USES_YARP)
list(APPEND _IDYNTREE_EXPORTED_DEPENDENCIES YARP)
Expand All @@ -68,14 +68,22 @@ if(NOT IDYNTREE_ONLY_DOCS)
list(APPEND _IDYNTREE_EXPORTED_DEPENDENCIES orocos_kdl)
endif()

# List exported CMake package dependencies when the library is compiled as static
set(_IDYNTREE_EXPORTED_DEPENDENCIES_ONLY_STATIC "")
list(APPEND _IDYNTREE_EXPORTED_DEPENDENCIES_ONLY_STATIC LibXml2)
if(IDYNTREE_USES_OSQPEIGEN)
list(APPEND _IDYNTREE_EXPORTED_DEPENDENCIES_ONLY_STATIC OsqpEigen)
endif()

include(InstallBasicPackageFiles)
install_basic_package_files(iDynTree VARS_PREFIX ${VARS_PREFIX}
VERSION ${${VARS_PREFIX}_VERSION}
COMPATIBILITY AnyNewerVersion
TARGETS_PROPERTY ${VARS_PREFIX}_TARGETS
NO_CHECK_REQUIRED_COMPONENTS_MACRO
ENABLE_COMPATIBILITY_VARS
DEPENDENCIES ${_IDYNTREE_EXPORTED_DEPENDENCIES})
DEPENDENCIES ${_IDYNTREE_EXPORTED_DEPENDENCIES}
PRIVATE_DEPENDENCIES ${_IDYNTREE_EXPORTED_DEPENDENCIES_ONLY_STATIC})

include(AddUninstallTarget)

Expand Down
4 changes: 2 additions & 2 deletions cmake/iDynTreeDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if (IDYNTREE_USES_ICUB)
endif ()

idyntree_handle_dependency(IPOPT)
idyntree_handle_dependency(Irrlicht)
idyntree_handle_dependency(Irrlicht DO_NOT_SILENTLY_SEARCH)
idyntree_handle_dependency(Qt5 COMPONENTS Qml Quick Widgets)
idyntree_handle_dependency(OsqpEigen MAIN_TARGET OsqpEigen::OsqpEigen)
idyntree_handle_dependency(ALGLIB DO_NOT_SILENTLY_SEARCH)
Expand All @@ -96,6 +96,6 @@ if(IDYNTREE_USES_ALGLIB AND ALGLIB_FOUND)
message(FATAL_ERROR "Exactly ALGLIB version ${ALGLIB_REQUIRED_VERSION} is required, but ${ALGLIB_VERSION} is available.")
endif()
endif()
idyntree_handle_dependency(WORHP)
idyntree_handle_dependency(WORHP DO_NOT_SILENTLY_SEARCH)
# Workaround for https://github.com/robotology/idyntree/issues/599
idyntree_handle_dependency(ASSIMP DO_NOT_SILENTLY_SEARCH MAIN_TARGET assimp::assimp)

0 comments on commit 50d6d03

Please sign in to comment.