[cmake-developers] Making _IMPORT_PREFIX from an installed exports-file available to an including file
Brad King
brad.king at kitware.com
Mon Jun 6 09:50:27 EDT 2011
On 06/04/2011 04:28 PM, Alexander Neundorf wrote:
> I'd like to do from my FooConfig.cmake file something like:
>
> include(${CMAKE_CURRENT_LIST_DIR}/FooExports.cmake)
> set(FOO_INCLUDE_DIR ${FooExports_IMPORT_PREFIX}/include )
IIRC there is a case when the prefix is not computed, perhaps if the
install(EXPORT) command is given an absolute DESTINATION. In cases
when it is computed this information is certainly useful though. I
have several times essentially duplicated that logic by hand in a
FooConfig.cmake file (similar to Michael's response).
> Related to this, why is this location computed in the configuration-specific
> file, and not once in the "parent" exports-file, which includes all the
> export-files for the different configurations ?
It's just an implementation detail that happens to work that way and may
have been easier when first developed.
> If so, would it be ok if I move the code for calculating the IMPORT_PREFIX
> into the "parent" exports file ?
Yes. It can be computed up front before loading the per-config files.
-Brad
More information about the cmake-developers
mailing list