Subject: bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH

From: 宋文武 <[email-masked]>
Date: Tue, 04 Nov 2014 20:42:47 +0800

Ludovic Courtès <[email-masked]> writes:

> 宋文武 <[email-masked]> skribis:
>
>> Ludovic Courtès <[email-masked]> writes:
>>
>>> 宋文武 <[email-masked]> skribis:
>>>
>>>> if CMAKE_INSTALL_LIBDIR not set to `lib`, GNUInstallDirs.cmake will install
>>>> libraries files to $out/lib64.
>>>
>>> I found several CMake-built libraries on x86_64 (graphite2, openjpeg,
>>> qjson) that all use lib/, not lib64/.
>>>
>>> Then I found one counterexample, libftdi; however, setting
>>> CMAKE_INSTALL_LIBDIR=lib doesn’t make any different: it still installs
>>> libraries in $out/lib64.  Any idea?
>> libftdi (not using GNUInstallDirs.cmake) handle this itself by
>> set LIB_SUFFIX, look like we have to set it specifically.
>
> Ah, OK.
>
> Still, graphite2, openjpeg, and qjson all install to $prefix/lib, even
> when not passing CMAKE_INSTALL_LIBDIR=lib.  Is it really needed?
Not sure, it's just for packages using GNUInstallDirs.cmake.
>
>>>> if CMAKE_PREFIX_PATH not set to PATH of `inputs`, cmake will unable to
>>>> find cmake modules of inputs.
>>>
>>> You’re talking about .cmake files, right?
>> yes, but now I find out that they can under both lib/cmake and share/cmake.
>
> In that case...
>
>>> +      ;; Search path used by 'FIND_PACKAGE' and 'INCLUDE'.
>>> +      (search-path-specification
>>> +       (variable "CMAKE_MODULE_PATH")
>>> +       (directories '("lib/cmake")))))
>                                     ^
> ... just add "share/cmake" here. ---’
>
> Could you try that?
Well, it not work, here is the exact output by liblxqt:

  By not providing "FindQt5Xdg.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Xdg", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Xdg" with any
  of the following names:

    Qt5XdgConfig.cmake
    qt5xdg-config.cmake

  Add the installation prefix of "Qt5Xdg" to CMAKE_PREFIX_PATH or set
  "Qt5Xdg_DIR" to a directory containing one of the above files.  If "Qt5Xdg"
  provides a separate development package or SDK, be sure it has been
  installed.

Since FindQt5Xdg.cmake is not provided by upstream, it looks like we have to set
CMAKE_PREFIX_PATH or Qt5Xdg_DIR.

And if I understand correctly, at liblxqt side, since #:configure-flags can
not refer inputs, I have to add a pre-configure phase, then using setenv.
>
>> after add CMAKE_PREFIX_PATH with:
>>
>>   (search-path-specification
>>     (variable "CMAKE_PREFIX_PATH")
>>     (directories '("")))
>
> I thought about it, but that "" is inelegant and not as clear.
Yes, it not feeling good, but I have no better idea now.
>
>> and here is the packages I'm working on:
>
> Looks like a good start.  :-)
>
> Thanks,
> Ludo’.