Skip to content

Commit

Permalink
Pull up module path tweaks to main config file
Browse files Browse the repository at this point in the history
This is a follow up to robotology#1733 for non-static YARP builds, which
were prone to cause similar errors in downstreams (see robotology#1736) due
to internal dependencies (e.g. TinyXML) not being found.
  • Loading branch information
PeterBowman committed Jun 10, 2018
1 parent e709b46 commit bc8f06f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 8 additions & 0 deletions cmake/template/YARPConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ if (CMAKE_VERSION VERSION_LESS 3.9)
endif()
endif()

# Provide YARP's own module search paths for internal use by find_package()
set(_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# Include YARPTargets.cmake file (that includes for now, targets without a
# specific destination
if(NOT TARGET YARP::yarpidl_thrift)
Expand Down Expand Up @@ -167,6 +171,10 @@ foreach(_module ${YARP_FIND_COMPONENTS})
list(APPEND YARP_LIBRARIES YARP::YARP_${_module})
endforeach()

# Restore the original situation
set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH})
unset(_CMAKE_MODULE_PATH)

# Ensure that all requested modules are available
check_required_components(YARP)

Expand Down
6 changes: 0 additions & 6 deletions cmake/template/YARPTargetsStatic.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ if(NOT "${_expected_targets}" STREQUAL "")
list(REMOVE_DUPLICATES _expected_targets)
endif()

# Provide YARP's own module search paths for use by find_package()
set(_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# Properly find the dependencies. This will force to include all the
# dependencies also for packages in other exports
foreach(_target ${_targets})
Expand All @@ -56,8 +52,6 @@ foreach(_target ${_targets})
endforeach()

# Restore the original situation
set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH})
unset(_CMAKE_MODULE_PATH)
unset(YARP_static_hack_FOUND)
unset(YARP_static_hack_NOT_FOUND_MESSAGE)
set(CMAKE_FIND_PACKAGE_NAME ${_CMAKE_FIND_PACKAGE_NAME})
Expand Down

0 comments on commit bc8f06f

Please sign in to comment.