Yarp: YARP 2.3.73.5 (current devel branch) broken with CMake 3.5

Created on 4 Jun 2018  路  6Comments  路  Source: robotology/yarp

Originally reported by @PeterBowman in

https://github.com/robotology/yarp/blob/57ed8688762e5fbaf7dfa5d202a0427e314f2ee3/cmake/template/YARPConfig.cmake.in#L142-L144

This is breaking builds in YARP downstreams on Xenial (CMake 3.5.1). Support for additional parameters to find_dependency() was added at CMake 3.9 (which is used by Travis, hence no CI build errors).

Docs:

cc @drdanz

CMake Bug Release Blocker

All 6 comments

The resulting error in downstream packages is similar to the following:
~~~
straversaro@iiticublap103:~/src/robotology-superbuild/build/robotology/ICUB$ make
CMake Error at /usr/share/cmake-3.5/Modules/CMakeFindDependencyMacro.cmake:45 (message):
Invalid arguments to find_dependency
Call Stack (most recent call first):
/home/straversaro/src/robotology-superbuild/build/install/lib/cmake/YARP/YARPConfig.cmake:166 (find_dependency)
CMakeLists.txt:37 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/straversaro/src/robotology-superbuild/build/robotology/ICUB/CMakeFiles/CMakeOutput.log".
See also "/home/straversaro/src/robotology-superbuild/build/robotology/ICUB/CMakeFiles/CMakeError.log".
Makefile:894: recipe for target 'cmake_check_build_system' failed
make: * [cmake_check_build_system] Error 1
~~~

Right now we have:

https://github.com/robotology/yarp/blob/57ed8688762e5fbaf7dfa5d202a0427e314f2ee3/cmake/template/YARPConfig.cmake.in#L139-L147

This should work at the upmost level (YARPConfig.cmake):

# Find all requested components
set(YARP_LIBRARIES YARP::YARP_init)
foreach(_module ${YARP_FIND_COMPONENTS})
  include("${YARP_CMAKECONFIG_DIR}/YARP_${_module}/YARP_${_module}Config.cmake"
          RESULT_VARIABLE _have_yarp_${_module})
  if(NOT _have_yarp_${_module})
    set(YARP_FOUND FALSE)
    set(YARP_NOTFOUND_MESSAGE "Missing component: YARP::YARP_${_module}")
  else()
    list(APPEND YARP_LIBRARIES YARP::YARP_${_module})
  endif()
  unset(_have_yarp_${_module})
endforeach()

I just followed the CMake manual. However, specific components (e.g. YARP_devConfig.cmake) will still fail, I presume something at InstallBasicPackageFiles.cmake have to be changed, too.

I presume something at InstallBasicPackageFiles.cmake have to be changed, too.

Correction: YarpInstallBasicPackageFiles.cmake.

It looks like YARP components are being treated as separate packages, that is, one could do:

find_package(YARP_OS)
find_package(YARP_dev)
# etc.

Not sure if this was intended, seems a bit overkill. All export sets could be installed into the same system directory (e.g. /usr/local/lib/cmake/YARP), now they are scattered around as quite complete CMake packages (config file + targets file + version file) in sibling folders.

@PeterBowman This was intended, it follows the same convention used by Qt5... It simplifies creating separate binary packages. Also it allows one to install new "YARP" packages without actually installing stuff in YARP directory. I'm not saying this is the right decision (perhaps it is not, I wasn't 100% sure about this), but I had to choose between the two options, and after a few tested I was in favour of separate packages, and for now I'm sticking with this decision...

Fixed by #1731

Was this page helpful?
0 / 5 - 0 ratings