[cmake-developers] Multiple dependent install(EXPORT) sets
Stephen Kelly
steveire at gmail.com
Tue Nov 22 10:03:02 EST 2011
Brad King wrote:
> On 11/22/2011 9:31 AM, Stephen Kelly wrote:
>>> CMake Error: INSTALL(EXPORT "twoDeps" ...) includes target "libtwo"
>>> which requires target "libone" that is not in the export set.
>>>
>>> How can we resolve this?
>>
>> http://public.kitware.com/Bug/view.php?id=12588
>>
>> Brad asked to bring this up on the list for discussion.
>
> Additional CMake development is needed to support this. We need to
> introduce the notion of multiple dependent install(EXPORT) sets.
>
> I think the commands will look something like this:
>
> add_library(A ...)
> add_library(B ...)
> target_link_libraries(B A)
> install(TARGETS A ... EXPORT ExportA)
> install(TARGETS B ... EXPORT ExportB)
> install(EXPORT ExportA ...)
> install(EXPORT ExportB DEPENDS ExportA ...)
>
> The "DEPENDS ExportA" option to install(EXPORT) on the last line will need
> to
> be added and implemented. We will have to require that the
> install(EXPORT)
> commands be invoked in dependency order (ex. A before B). That way when
> the command installing ExportB is writing library B's dependency on A, it
> can transform the name using the options that had been given to the
> install
> command for ExportA, such as its NAMESPACE. Furthermore, the targets file
> generated for ExportB will need to include() the file generated for
> ExportA using the DESTINATION given to the latter to make its targets
> available.
And its FILE presumably, but why? This ties in to the question of whether
find_package(B) should find the dependencies of B:
case 1:
project(big_project)
find_package(A) // Uses AConfig.cmake, which includes ATargets.cmake
find_package(B) // Uses BConfig.cmake, which includes BTargets.cmake
case 2:
project(big_project)
find_package(B) // Uses BConfig.cmake, which includes BTargets.cmake
// and ATargets.cmake, but there was no find_package(A),
// so this is broken anyway.
case 3:
project(big_project)
find_package(B) // Uses BConfig.cmake, which runs find_package(A),
// includes BTargets.cmake and ATargets.cmake, despite the
// fact that, find_package(A) has the effect of including it
// anyway.
More information about the cmake-developers
mailing list