(see the nested /root/parts/plugin-ros/install/). This does not seem correct or what a user intended with -DCMAKE_INSTALL_PREFIX=${SNAPCRAFT_PART_INSTALL}.
This is what I expect the cmake plugin would do. Why does the cmake plugin create this nested install path and how do I tell the cmake plugin to behave as if I passed -DCMAKE_INSTALL_PREFIX=${SNAPCRAFT_PART_INSTALL} to cmake?
i guess your application already respects the $DESTDIR env variable (normally this would point to / but in snap builds it points to $SNAPCRAFT_PART_INSTALL) … the prefix would then normally be something like usr or usr/local, so you end up with:
$DESTDIR/$prefix
… i.e. / combined with usr/local …
what you are doing above is to effectively set your prefix to $DESTDIR again so you end up with
$DESTDIR/$DESTDIR
i’d just leave the install prefix alone and let it use the defaults, or set it to usr, that should make you end up with
The CMake project is pretty standard (I think). At least it is behaving as expected when setting the CMake variables manually.
As far as I understand, DESTDIR is usually a variable used by make, not by cmake. CMake uses CMAKE_INSTALL_PREFIX as the prefix. What you describe makes sense and would explain what I observed. Setting both to the same value makes no sense.
If the cmake plugin already sets DESTDIR, then CMAKE_INSTALL_PREFIX “prefix” becomes a “suffix”. I think this is wrong. The cmake plugin should set CMAKE_INSTALL_PREFIX and not DESTDIR. DESTDIR would be used if a user calls the install step manually, after the build scripts have been generated by cmake.
If I do not define CMAKE_INSTALL_PREFIX at all I get: