Menu

#26 Allow setting datadir as an absolute path

fixed
seebk
None
2017-08-16
2015-05-12
No

On my distro, we install arch-specific files into a different prefix (i.e. /usr/x86_64-pc-linux-gnu/) than data files (/usr/share). That requires the ability to set the latter to an absolute path.

The attached patch accounts for this according to
http://www.cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html

1 Attachments

Discussion

  • seebk

    seebk - 2015-05-16

    Thanks, the patch is now in git head.

     
  • seebk

    seebk - 2015-05-16
    • status: open --> accepted
    • assigned_to: seebk
     
  • Torsten Bronger

    Torsten Bronger - 2015-05-17
    • status: accepted --> open
     
  • Torsten Bronger

    Torsten Bronger - 2015-05-17

    I don't really know why, but Lensfun doesn't find its XML files anymore on my Ubuntu system since this commit. They are in /usr/local/share/lensfun

     
  • Torsten Bronger

    Torsten Bronger - 2015-05-18

    The attached diff solves the problem for me. Please review whether this is the clean way to go.

     
  • seebk

    seebk - 2015-05-18

    Oh something went wrong here, the patch was not complete and it also broke the install paths if DATAROOTDIR is not absolute.

    I have changed the CMake config again. It should now set the LENSFUN_XXX paths relative to LENSFUN_INSTALL_PREFIX by default. The LENSFUN_XXX can be overridden manually to select a different absolute path.

    INCLUDE(GNUInstallDirs) will read the GNU standard paths and set CMAKE_INSTALL_DATAROOTDIR. This will override LENSFUN_DATA with an absolute path and is kept till the end.

    I am not sure if this is currently the smartest solution, but I think it should now work for Torsten and for Bernd. Could you please both check it again?

     
  • Bernd Steinhauser

    Oh yes, sorry forgot to include the GNUInstallDirs.
    Anyway, that is possibly the way every cmake project should take on Univ/Linux instead of inventing horrible local solutions to set the dirs.
    (And I have really seen very horrible examples of setting these things.)

    I'll have a look and give you feedback tomorrow.

     
  • Torsten Bronger

    Torsten Bronger - 2015-05-19

    tests/test_database does not work for me on 4d87cb7.

     
  • seebk

    seebk - 2015-05-19

    Sorry, I forgot to modify the CONF_DATADIR path in the config.h header.

    This also revealed another bug... the tests always use the database which is installed in the system and cannot use the database from the current sources. This causes the problem that the test will always fail if you have not run make install before.

     
  • Bernd Steinhauser

    I had a look at it and there is an issue with the current code when setting the absolute path. Reason being:

    IF(NOT IS_ABSOLUTE ${LENSFUN_${dir}})
    SET(LENSFUN_FULL_${dir} "${LENSFUN_INSTALL_PREFIX}/${LENSFUN_${dir}}" CACHE INTERNAL "" FORCE)
    ENDIF()

    So if you set an absolute path to CMAKE_INSTALL_DATAROOTDIR that gets propagated to LENSFUN_DATADIR and subsequently LENSFUN_FULL_DATADIR gets not set.

    Other than that, it looks fine.

     
  • seebk

    seebk - 2015-05-20

    Sorry, I am a bit sloppy. Too much things to do at the same time. The latest commit should fix this now. The "ELSE()" was missing.

     
  • seebk

    seebk - 2015-10-11
    • status: open --> fixed
     
  • seebk

    seebk - 2015-10-28
    • status: fixed --> open
     
  • seebk

    seebk - 2015-10-28

    I have changed the setting of the install paths again. It should now comply with the CMake standard where all paths can be set individually by CMAKE_INSTALL_XXX. Please check if this still works for you and report back if not. Thanks!

     
  • seebk

    seebk - 2017-08-16
    • status: open --> fixed
     
  • seebk

    seebk - 2017-08-16

    No more feedback from reporter, seems to be working