* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
@ 2014-11-02 13:24 宋文武
2014-11-02 22:55 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: 宋文武 @ 2014-11-02 13:24 UTC (permalink / raw)
To: 18926
if CMAKE_INSTALL_LIBDIR not set to `lib`, GNUInstallDirs.cmake will install
libraries files to $out/lib64.
if CMAKE_PREFIX_PATH not set to PATH of `inputs`, cmake will unable to
find cmake modules of inputs.
I find this when packaging https://github.com/lxdg/libqtxdg.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2014-11-02 13:24 bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH 宋文武
@ 2014-11-02 22:55 ` Ludovic Courtès
2014-11-03 13:44 ` 宋文武
0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2014-11-02 22:55 UTC (permalink / raw)
To: 宋文武; +Cc: 18926
[-- Attachment #1: Type: text/plain, Size: 473 bytes --]
宋文武 <iyzsong@gmail.com> 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?
Here’s the patch I tried:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 677 bytes --]
diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index 74b4f01..b1598dd 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -53,6 +53,8 @@
build-type))
'())
,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
+ ;; Install libraries to $prefix/lib, not $prefix/lib64.
+ "-DCMAKE_INSTALL_LIBDIR=lib"
;; add input libraries to rpath
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
;; add (other) libraries of the project itself to rpath
[-- Attachment #3: Type: text/plain, Size: 330 bytes --]
According to <http://www.cmake.org/Wiki/CMake_Useful_Variables>,
LIBRARY_OUTPUT_PATH might be better for this, no?
> 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?
Could you try the attached patch and report back?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: the patch --]
[-- Type: text/x-patch, Size: 2212 bytes --]
From 536c143997fa146dc77d6e8defc24032452e5a4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Sun, 2 Nov 2014 23:54:28 +0100
Subject: [PATCH] gnu: cmake: Add search paths for
CMAKE_{INCLUDE,LIBRARY,MODULE}_PATH.
* gnu/packages/cmake.scm (cmake)[native-search-paths]: New field.
* guix/build/cmake-build-system.scm (configure): Remove 'setenv' calls
for "CMAKE_LIBRARY_PATH" and "CMAKE_INCLUDE_PATH".
---
gnu/packages/cmake.scm | 19 +++++++++++++++++++
guix/build/cmake-build-system.scm | 2 --
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 63805ef..e0349be 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -100,6 +100,25 @@
("expat" ,expat)
("bzip2" ,bzip2)
("libarchive" ,libarchive)))
+
+ (native-search-paths
+ (list
+ ;; Search path used by the 'FIND_XXX' functions.
+ (search-path-specification
+ (variable "CMAKE_PROGRAM_PATH")
+ (directories '("bin")))
+ (search-path-specification
+ (variable "CMAKE_INCLUDE_PATH")
+ (directories '("include")))
+ (search-path-specification
+ (variable "CMAKE_LIBRARY_PATH")
+ (directories '("lib" "lib64")))
+
+ ;; Search path used by 'FIND_PACKAGE' and 'INCLUDE'.
+ (search-path-specification
+ (variable "CMAKE_MODULE_PATH")
+ (directories '("lib/cmake")))))
+
(home-page "http://www.cmake.org/")
(synopsis "Cross-platform build system")
(description
diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index b1598dd..766797e 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -60,8 +60,6 @@
;; add (other) libraries of the project itself to rpath
,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
,@configure-flags)))
- (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
- (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
(format #t "running 'cmake' with arguments ~s~%" args)
(zero? (apply system* "cmake" args)))))
--
2.1.2
[-- Attachment #5: Type: text/plain, Size: 102 bytes --]
> I find this when packaging https://github.com/lxdg/libqtxdg.
It’s 404.
Thanks,
Ludo’.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2014-11-02 22:55 ` Ludovic Courtès
@ 2014-11-03 13:44 ` 宋文武
2014-11-03 16:53 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: 宋文武 @ 2014-11-03 13:44 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 18926
[-- Attachment #1: Type: text/plain, Size: 4917 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> 宋文武 <iyzsong@gmail.com> 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.
>
> Here’s the patch I tried:
>
> diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
> index 74b4f01..b1598dd 100644
> --- a/guix/build/cmake-build-system.scm
> +++ b/guix/build/cmake-build-system.scm
> @@ -53,6 +53,8 @@
> build-type))
> '())
> ,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
> + ;; Install libraries to $prefix/lib, not $prefix/lib64.
> + "-DCMAKE_INSTALL_LIBDIR=lib"
> ;; add input libraries to rpath
> "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
> ;; add (other) libraries of the project itself to rpath
>
> According to <http://www.cmake.org/Wiki/CMake_Useful_Variables>,
> LIBRARY_OUTPUT_PATH might be better for this, no?
no, this is for build phase.
>
>> 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.
>
> Could you try the attached patch and report back?
>
> From 536c143997fa146dc77d6e8defc24032452e5a4c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
> Date: Sun, 2 Nov 2014 23:54:28 +0100
> Subject: [PATCH] gnu: cmake: Add search paths for
> CMAKE_{INCLUDE,LIBRARY,MODULE}_PATH.
>
> * gnu/packages/cmake.scm (cmake)[native-search-paths]: New field.
> * guix/build/cmake-build-system.scm (configure): Remove 'setenv' calls
> for "CMAKE_LIBRARY_PATH" and "CMAKE_INCLUDE_PATH".
> ---
> gnu/packages/cmake.scm | 19 +++++++++++++++++++
> guix/build/cmake-build-system.scm | 2 --
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
> index 63805ef..e0349be 100644
> --- a/gnu/packages/cmake.scm
> +++ b/gnu/packages/cmake.scm
> @@ -100,6 +100,25 @@
> ("expat" ,expat)
> ("bzip2" ,bzip2)
> ("libarchive" ,libarchive)))
> +
> + (native-search-paths
> + (list
> + ;; Search path used by the 'FIND_XXX' functions.
> + (search-path-specification
> + (variable "CMAKE_PROGRAM_PATH")
> + (directories '("bin")))
> + (search-path-specification
> + (variable "CMAKE_INCLUDE_PATH")
> + (directories '("include")))
> + (search-path-specification
> + (variable "CMAKE_LIBRARY_PATH")
> + (directories '("lib" "lib64")))
> +
> + ;; Search path used by 'FIND_PACKAGE' and 'INCLUDE'.
> + (search-path-specification
> + (variable "CMAKE_MODULE_PATH")
> + (directories '("lib/cmake")))))
> +
> (home-page "http://www.cmake.org/")
> (synopsis "Cross-platform build system")
> (description
> diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
> index b1598dd..766797e 100644
> --- a/guix/build/cmake-build-system.scm
> +++ b/guix/build/cmake-build-system.scm
> @@ -60,8 +60,6 @@
> ;; add (other) libraries of the project itself to rpath
> ,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
> ,@configure-flags)))
> - (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
> - (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
> (format #t "running 'cmake' with arguments ~s~%" args)
> (zero? (apply system* "cmake" args)))))
>
> --
> 2.1.2
thanks for the patch, I have apply it, but it does not work.
because libqtxdg have qtxdg-config.cmake in $out/share/cmake/qt5xdg.
after add CMAKE_PREFIX_PATH with:
(search-path-specification
(variable "CMAKE_PREFIX_PATH")
(directories '("")))
I could get liblxqt(use libqtxdg) build ok.
and by setting CMAKE_PREFIX_PATH, I think we can get rid of
CMAKE_PROGRAM_PATH, CMAKE_INCLUDE_PATH, and maybe CMAKE_LIBRARY_PATH.
see: http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html.
>
>
>> I find this when packaging https://github.com/lxdg/libqtxdg.
>
> It’s 404.
oh, sorry, it's https://github.com/lxde/libqtxdg
and here is the packages I'm working on:
[-- Attachment #2: lxqt.scm --]
[-- Type: application/octet-stream, Size: 1817 bytes --]
(define-module (lxqt)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
#:use-module (guix build-system cmake)
#:use-module (gnu packages)
#:use-module (gnu packages qt)
#:use-module (gnu packages pkg-config))
(define-public libqtxdg
(package
(name "libqtxdg")
(version "1.0.0")
(source
(origin
(method url-fetch)
(uri (string-append "http://lxqt.org/downloads/" name "/" version "/"
name "-" version ".tar.xz"))
(sha256
(base32
"1qg2hjd0ybglvpxyx351lxms25nciipyilwpf7g42z5wg62j2xad"))))
(build-system cmake-build-system)
(arguments
`(#:tests? #f ; failed
#:configure-flags '("-DCMAKE_INSTALL_LIBDIR=lib"
"-DUSE_QT5=ON"
"-DBUILD_TESTS=ON")))
(inputs
`(("qt" ,qt)))
(home-page "http://lxqt.org/")
(synopsis "Qt implementation of freedesktop xdg specs")
(description "FIXME")
(license lgpl2.1+)))
(define-public liblxqt
(package
(name "liblxqt")
(version "0.8.0")
(source
(origin
(method url-fetch)
(uri (string-append "http://lxqt.org/downloads/lxqt/" version "/"
name "-" version ".tar.xz"))
(sha256
(base32
"0kp36vb8zcaa1rkkdpqm966wh74l9jdla2mhrcw38hma1kiaf54r"))))
(build-system cmake-build-system)
(arguments
`(#:tests? #f ; no check target
#:configure-flags '("-DUSE_QT5=ON")))
(native-inputs `(("pkg-config" ,pkg-config)))
(inputs
`(("qt" ,qt)
("libqtxdg" ,libqtxdg)))
(home-page "http://lxqt.org/")
(synopsis "Core utility library for all LXDE-Qt components")
(description "FIXME")
(license lgpl2.1+)))
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2014-11-03 13:44 ` 宋文武
@ 2014-11-03 16:53 ` Ludovic Courtès
2014-11-04 12:42 ` 宋文武
0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2014-11-03 16:53 UTC (permalink / raw)
To: 宋文武; +Cc: 18926
宋文武 <iyzsong@gmail.com> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> 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?
>>> 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?
> 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.
> and here is the packages I'm working on:
Looks like a good start. :-)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2014-11-03 16:53 ` Ludovic Courtès
@ 2014-11-04 12:42 ` 宋文武
2015-01-04 17:06 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: 宋文武 @ 2014-11-04 12:42 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 18926
Ludovic Courtès <ludo@gnu.org> writes:
> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> 宋文武 <iyzsong@gmail.com> 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’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2014-11-04 12:42 ` 宋文武
@ 2015-01-04 17:06 ` Ludovic Courtès
2015-02-08 18:14 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-01-04 17:06 UTC (permalink / raw)
To: 宋文武; +Cc: 18926
宋文武 <iyzsong@gmail.com> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>> 宋文武 <iyzsong@gmail.com> 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:
[...]
>>> 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.
In ‘core-updates’ it’s now possible to specify file patterns, so we
could look for *.cmake files under lib/cmake or share/cmake like this:
(search-path-specification
(variable "CMAKE_MODULE_PATH")
(files '("lib/cmake" "share/cmake"))
(file-type 'regular)
(file-pattern "\\.cmake$"))
Would it help? What else is needed?
Ludo’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2015-01-04 17:06 ` Ludovic Courtès
@ 2015-02-08 18:14 ` Ludovic Courtès
2015-03-01 9:58 ` Andreas Enge
0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-02-08 18:14 UTC (permalink / raw)
To: 宋文武; +Cc: 18926
ludo@gnu.org (Ludovic Courtès) skribis:
> In ‘core-updates’ it’s now possible to specify file patterns, so we
> could look for *.cmake files under lib/cmake or share/cmake like this:
>
> (search-path-specification
> (variable "CMAKE_MODULE_PATH")
> (files '("lib/cmake" "share/cmake"))
> (file-type 'regular)
> (file-pattern "\\.cmake$"))
>
> Would it help? What else is needed?
Any updates on this bug? I’d like to know if the above solution
addresses the problem or if more is needed.
TIA,
Ludo’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2015-02-08 18:14 ` Ludovic Courtès
@ 2015-03-01 9:58 ` Andreas Enge
2015-03-01 14:35 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2015-03-01 9:58 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 18926
The patch does not work. I thought this was due to it returning the .cmake
files themselves and not the directory containing them. Here, for instance,
it contains
/gnu/store/h30r6z3fc67h8557kd63vjjdlfpc58wj-libqtxdg-1.1.0/share/cmake/qt5xdg/qt5xdg-config.cmake
Inside the build directory, I tried an
export CMAKE_MODULE_PATH=/gnu/store/h30r6z3fc67h8557kd63vjjdlfpc58wj-libqtxdg-1.1.0/share/cmake/qt5xdg
with the same error message.
Then I followed the advice given on screen and set
export CMAKE_PREFIX_PATH=/gnu/store/h30r6z3fc67h8557kd63vjjdlfpc58wj-libqtxdg-1.1.0
which worked.
export Qt5Xdg_DIR=/gnu/store/h30r6z3fc67h8557kd63vjjdlfpc58wj-libqtxdg-1.1.0/share/cmake/qt5xdg
worked as well. But I do not see how to implement this kind of package
specific path in guix.
The following explains why CMAKE_MODULE_PATH has no effect here:
http://www.cmake.org/cmake/help/v3.0/command/find_package.html
Apparently, there is a "module mode" and a "config mode". The first one uses
CMAKE_MODULE_PATH and looks for files called FindPACKAGE.cmake. We are in the
second case here, where a file PACKAGEConfig.cmake or package-config.cmake
is looked for.
Further below on that page, it is explained where these config files are
looked for. On unix like systems, this is
<prefix>/(lib/<arch>|lib|share)/cmake/<name>*/
<prefix>/(lib/<arch>|lib|share)/<name>*/
<prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/
The <prefix> part can be set by CMAKE_PREFIX_PATH.
What would be desirable is the following:
In the definition of a search path, we need an additional transformation
(if it is not already there). We need to look for the regular expression
(.+)/(lib|lib64|share)/.+\.cmake$
or maybe
(.+)/(lib|lib/[^/]+|share)/.+\.cmake$
and put
\1
into CMAKE_PREFIX_PATH.
I think that would also make the lines
(setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
(setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
in guix/build/cmake-build-system obsolete.
Concerning the "lib64" part, I still have doubts. The documentation speaks
of "lib/<arch>"; yet, there are packages which install into "lib64" (like
libqtxdg, needed for liblxqt, which triggered this discussion).
So if the suggestion above does not work, we can in a second step try
to play with CMAKE_INSTALL_LIBDIR.
Andreas
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2015-03-01 9:58 ` Andreas Enge
@ 2015-03-01 14:35 ` Ludovic Courtès
2015-03-01 20:11 ` Andreas Enge
0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2015-03-01 14:35 UTC (permalink / raw)
To: Andreas Enge; +Cc: 18926
Andreas Enge <andreas@enge.fr> skribis:
> What would be desirable is the following:
> In the definition of a search path, we need an additional transformation
> (if it is not already there). We need to look for the regular expression
> (.+)/(lib|lib64|share)/.+\.cmake$
> or maybe
> (.+)/(lib|lib/[^/]+|share)/.+\.cmake$
> and put
> \1
> into CMAKE_PREFIX_PATH.
That’s not currently possible using the search path mechanism (and I
can’t imagine such weird semantics.)
I can imagine two solutions, in order of preference:
1. Find CMAKE_ environment variables that can be set using the search
path mechanism. Many environment variables are documented, is
there really none that we can use?
2. Add custom code to cmake-build-system.scm instead of using the
search path mechanism.
WDYT?
Thanks for taking the time to investigate!
Ludo’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2015-03-01 14:35 ` Ludovic Courtès
@ 2015-03-01 20:11 ` Andreas Enge
2015-03-14 15:11 ` Andreas Enge
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2015-03-01 20:11 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 18926
On Sun, Mar 01, 2015 at 03:35:51PM +0100, Ludovic Courtès wrote:
> That’s not currently possible using the search path mechanism (and I
> can’t imagine such weird semantics.)
I think the semantics is relatively clear: Match file names with a regular
expression and, if there is a match, add the result to a search path.
It is much like search-replace with regular expressions.
But of course, the search path could become very long: Essentially each
package built with cmake would contribute an entry.
> I can imagine two solutions, in order of preference:
> 1. Find CMAKE_ environment variables that can be set using the search
> path mechanism. Many environment variables are documented, is
> there really none that we can use?
The problem here is that the .cmake files are in a subdirectory which is
named after the package. I think our current search path specification
cannot handle this, since we can only use it with fixed prefixes of a full
file location. One possibility would be to use CMAKE_PREFIX_PATH, which
should contain the install location of input packages. So the code proposed
in a previous message:
(search-path-specification
(variable "CMAKE_PREFIX_PATH")
(directories '("")))
should work. In practice, in a user profile, it would amount to only the
profile root, which makes sense: This is the install location from a user
point of view. In the build environment, it would add one entry for each
input, but I do not see a way of singling out only the packages built with
cmake.
> 2. Add custom code to cmake-build-system.scm instead of using the
> search path mechanism.
One could try to emulate the "trivial" search path above by adding each input
to CMAKE_PREFIX_PATH. But it would not solve the problem that a user install-
ing a library built with cmake (like libqtxdg) into his profile would not be
able to compile another package (like liblxqt) requiring it.
I also thought about searching for package-config.cmake files and defining
an environment variable PACKAGE_DIR if one is found. The problem is
capitalisation: Here we find
/gnu/store/...-libqtxdg-1.1.0/share/cmake/qt5xdg/qt5xdg-config.cmake
and need to set the environment variable
Qt5Xdg_DIR .
It is impossible to guess this!
All in all, I am in favour of using the trivial search path with the ""
directory. It would be activated only if cmake is an input, or a user
installs cmake into his profile.
Andreas
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH
2015-03-01 20:11 ` Andreas Enge
@ 2015-03-14 15:11 ` Andreas Enge
0 siblings, 0 replies; 11+ messages in thread
From: Andreas Enge @ 2015-03-14 15:11 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 18926-done
Commit 0d6f936 fixes the issue with CMAKE_PREFIX_PATH.
I am closing this bug; if a problem occurs with CMAKE_INSTALL_LIBDIR,
we may reopen it.
Andreas
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-03-14 15:12 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-02 13:24 bug#18926: cmake-build-system should set CMAKE_INSTALL_LIBDIR and CMAKE_PREFIX_PATH 宋文武
2014-11-02 22:55 ` Ludovic Courtès
2014-11-03 13:44 ` 宋文武
2014-11-03 16:53 ` Ludovic Courtès
2014-11-04 12:42 ` 宋文武
2015-01-04 17:06 ` Ludovic Courtès
2015-02-08 18:14 ` Ludovic Courtès
2015-03-01 9:58 ` Andreas Enge
2015-03-01 14:35 ` Ludovic Courtès
2015-03-01 20:11 ` Andreas Enge
2015-03-14 15:11 ` Andreas Enge
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.