[CMake] MSVC7.1 static link question
Luigi Calori
l.calori at cineca.it
Thu Feb 12 11:43:41 EST 2009
Philip Lowman ha scritto:
> On Wed, Feb 11, 2009 at 8:54 AM, Brad King <brad.king at kitware.com
> <mailto:brad.king at kitware.com>> wrote:
>
> Philip Lowman wrote:
>
> On Tue, Feb 10, 2009 at 1:01 PM, Brad King
> <brad.king at kitware.com <mailto:brad.king at kitware.com> CMake
> 2.6 makes it easy to export targets from one project (either its
>
> build tree or install tree) for use by another project.
>
> Is this the easiest way to register dependencies of IMPORTED
> static libraries against each other? I'm just curious if
> there are plans to make target_link_libraries() work for this
> or is there a technical problem allowing it?
>
>
> I do not plan to allow target_link_libraries for this. One must use
> IMPORTED_LINK_INTERFACE_LIBRARIES. However, it is easier than your
> example makes it because the property can name other imported
> targets:
>
>
> add_library(baz STATIC IMPORTED)
> set_target_properties(baz PROPERTIES
> IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/libbaz.a
> IMPORTED_LOCATION_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/libbazd.a)
>
> add_library(bar STATIC IMPORTED)
> set_target_properties(bar PROPERTIES
> IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/libbar.a
> IMPORTED_LOCATION_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/libbard.a
> IMPORTED_LINK_INTERFACE_LIBRARIES baz) # <-- dependency is here
>
I' ma bit confused, just to make clear: the proposed import method are
used in the final projects that USES the libraries.
by install(EXPORT) the needed code is hidden in a config--baz--cmake
file that is evaluated inby the final project tha so does not have to
rely on FindBAZ script.
But effectively this is just a way to hide the fact that the final
project links to both libbaz and libbar
The specification of dependency lib as a STATIC_LIBRARY_FLAGS produce a
bigger library tha has both baz and bar, and can be used straight, at
least under VS7.1
I appreciate the IMPORT and EXPORT stuff and will try to use that (could
we use that also for the whole OpenSceneGraph itself ? what do you think
Philip?)
Nevertheless the STATIC_LIBRARY_FLAGS seems much simpler
Thanks
>
> Yes, thanks for pointing that out, that is much simpler.
>
> Note if the outside project is also created by CMake, the
> install(EXPORT)
> feature can generate the proper import code for it.
>
>
> Yes, I hope to play with that feature soon. Thanks.
>
> --
> Philip Lowman
More information about the CMake
mailing list