Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Use packager friendly install paths (CMake: GNUInstallDirs) [13709]

Open panicgh opened this issue 3 years ago • 0 comments

Expected Behavior

A maintainer from a Linux distro packages Fast-DDS and needs to customize some installation destinations using the standard variables from GNUInstallDirs as described also in install. For example, the maintainer configures CMake with -DCMAKE_INSTALL_DOCDIR=doc/eprosima/fastdds. Documentation files are then installed into /usr/share/doc/eprosima/fastdds.

Current Behavior

GNUInstallDirs are ignored making it very difficult for package maintainers to customize the installation paths for the distribution package.

Steps to Reproduce

Setup a plain Debian 11 VM and do:

u1@debian:~$ sudo apt install -y cmake g++ python3-pip wget git libasio-dev libtinyxml2-dev libssl-dev doxygen graphviz unzip
u1@debian:~$ 
u1@debian:~$ mkdir ~/Fast-DDS
u1@debian:~$ cd ~/Fast-DDS

u1@debian:~/Fast-DDS$ git clone https://github.com/eProsima/foonathan_memory_vendor.git
u1@debian:~/Fast-DDS$ mkdir foonathan_memory_vendor/build
u1@debian:~/Fast-DDS$ cd foonathan_memory_vendor/build
u1@debian:~/Fast-DDS/foonathan_memory_vendor/build$ cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ON
u1@debian:~/Fast-DDS/foonathan_memory_vendor/build$ sudo cmake --build . --target install
u1@debian:~/Fast-DDS/foonathan_memory_vendor/build$ cd ../../

u1@debian:~/Fast-DDS$ git clone https://github.com/eProsima/Fast-CDR.git
u1@debian:~/Fast-DDS$ mkdir Fast-CDR/build
u1@debian:~/Fast-DDS$ cd Fast-CDR/build
u1@debian:~/Fast-DDS/Fast-CDR/build$ cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install
u1@debian:~/Fast-DDS/Fast-CDR/build$ sudo cmake --build . --target install
u1@debian:~/Fast-DDS/Fast-CDR/build$ cd ../../

u1@debian:~/Fast-DDS$ git clone https://github.com/eProsima/Fast-DDS.git
u1@debian:~/Fast-DDS$ mkdir Fast-DDS/build
u1@debian:~/Fast-DDS$ cd Fast-DDS/build

Now follows the important part:

u1@debian:~/Fast-DDS/Fast-DDS/build$ cmake ..  -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DCMAKE_PREFIX_PATH=~/Fast-DDS/install -DBUILD_DOCUMENTATION=ON -DCMAKE_INSTALL_DOCDIR=doc/eprosima/fastdds
...
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_INSTALL_DOCDIR


-- Build files have been written to: /home/u1/Fast-DDS/Fast-DDS/build
u1@debian:~/Fast-DDS/Fast-DDS/build$ sudo cmake --build . --target install
u1@debian:~/Fast-DDS/Fast-DDS/build$ cd ../../install

u1@debian:~/Fast-DDS/install$ ls -l share/
total 20
drwxr-xr-x 4 root root 4096 Nov 15 21:34 doc
drwxr-xr-x 2 root root 4096 Nov 15 21:11 fastcdr
drwxr-xr-x 3 root root 4096 Nov 15 21:23 fastrtps
drwxr-xr-x 2 root root 4096 Nov 15 21:09 foonathan_memory
drwxr-xr-x 3 root root 4096 Nov 15 21:09 foonathan_memory_vendor
u1@debian:~/Fast-DDS/install$ ls -l share/doc/
total 348
drwxr-xr-x 3 root root 159744 Nov 15 21:34 api_reference
drwxr-xr-x 5 root root   4096 Nov 15 21:34 manual
-rw-r--r-- 1 root root 192318 Nov 15 21:30 README.html

Note the CMake warning and that the documentation files are still installed into share/doc instead of share/doc/eprosima/fastdds as specified.

System information

  • Debian 11.1 VM

Additional context

Fast-DDS's non-standard install directory variables are defined here: https://github.com/eProsima/Fast-DDS/blob/master/CMakeLists.txt#L100-L110

I think it should not be too difficult to replace them with an include(GNUInstallDirs) and use the standard variable names.

panicgh avatar Nov 15 '21 20:11 panicgh