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