Closed traversaro closed 4 years ago
Thanks @traversaro :+1:
While the use of hardcoded absolute path may seems a error-prone strategy, considering that
ROSOnWindows
do not support being installed in a prefix different fromC:/opt
, it is a good way of detecting reliably if the project is being configured underROSOnWindows
.
Yes, I agree.
It's a work-around, but let's see what upstream does.
First of all, it is important to mention that the problem of not finding protoc on ROSOnWindowsis an upstream bug, reported in https://github.com/ms-iot/ROSOnWindows/issues/218 .
Until now, the use of the HINTS parameter in find_package make the CMake use the installed protobuf-config.cmake instead of the CMake's provided FindProtobuf.cmake that was used on non-WIN32. Note that the actual value of the parameter passed to HINTS does not matter, actually on my ROSOnWindows setup
${_CMAKE_INSTALL_DIR}/tools/protobuf
was actually the non-existing pathC:\opt\python27amd64\Scripts\tools\protobuf
.Unfortunately, the variables and macros exported by the protobuf 3.11's
protobuf-config.cmake
are not compatible with the one used in the project, so the configuration was not working correctly when using a modern protobuf such as the one installed by vcpkg.To have a CMake that is able to configure with protobuf and CMake installed in Ubuntu 16.04, againtt the protobuf installed by ROSOnWindows and also the latest protobuf installed by vcpkg, we use also on Windows the default signature of
find_package
, and as a workaround for https://github.com/ms-iot/ROSOnWindows/issues/218 we add toCMAKE_PROGRAM_PATH
theC:/opt/rosdeps/x64/tools/protobuf
ifC:/opt/rosdeps/x64
is part of the theCMAKE_PREFIX_PATH
. While the use of hardcoded absolute path may seems a error-prone strategy, considering thatROSOnWindows
do not support being installed in a prefix different fromC:/opt
, it is a good way of detecting reliably if the project is being configured underROSOnWindows
.