[CMake] export() vs. install(export...)

Tim Gallagher tim.gallagher at gatech.edu
Mon Sep 19 02:55:00 EDT 2011


It does make sense and answered most of my questions. Maybe rather than asking more questions, I can make some suggestions based on what I'm trying to do and see what people think:

1. It would be nice to be able to register installation trees in the registry so the user does not have to provide the <project>_DIR variable to find the config file. 

2. It would likewise be nice if entries in the registry could be distinguished based on something other than the project name. For instance, we are always building our libraries with Intel and GNU compilers (in different build trees) and installing them both (in different installation trees, it's a Fortran project, so the module files are incompatible). It would be awesome if there was a way for find_package() to track down the version compiled with the same compiler currently being used based on the compiler ID string or something. 

Maybe there is a clever way to accomplish both of these that I'm missing. But, the vast majority of the time people complain that our code doesn't compile is because they specified the wrong <project>_DIR variable and are mixing compilers. The registry seems like a great way to keep the user from having to figure out the <project>_DIR variable for each of the libraries, but right now I don't know how or if it can be done. 

Has anybody else come across a similar issue and found a solution? 

Thanks,

Tim

----- Original Message -----
From: "Michael Wild" <themiwi at gmail.com>
To: cmake at cmake.org
Sent: Monday, September 19, 2011 2:29:47 AM
Subject: Re: [CMake] export() vs. install(export...)

On 09/19/2011 01:14 AM, Tim Gallagher wrote:
> Hi,
> 
> I've been trying to figure out the exact differences between the 
> export() and install(export ...) functions and I have some questions 
> still.
> 
> From the documentation, EXPORT() makes available the build tree for
> a given target and puts the path to the build tree in the 
> ~/.cmake/packages/<project> directory while INSTALL(EXPORT ...)
> makes the install tree available.
> 
> What I don't understand is what happens with EXPORT() if you have 
> multiple builds of the same project. For example, we often build (in 
> two different directories) the same project with two compilers
> (Intel and GNU) and install them in two different locations. But the
> entries in the registry just show path names. How would
> find_package() work in that instance?

the ~/.cmake/packages/<project> registry is only queried if you don't
specify a <project>_DIR variable which points to a directory containing
the <lower-project>-config.cmake (or <project>Config.cmake) file. If not
specified, find_package() will use the latest build tree registered in
~/.cmake/package/<project>.

> 
> When using INSTALL(EXPORT ...), I can get the information I need by 
> INCLUDE'ing the file, but I cannot find that file without the user's 
> input. Is there a way to put the path to the install tree in the 
> registry? If so, how would find_package() behave with multiple 
> installs?

See the documentation of the find_package() command for information on
where CMake looks for <project>Config.cmake files.

> 
> If anybody has any suggestions, I would appreciate it.
> 
> Tim

Does this help?

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list