[CMake] MSVC7.1 static link question
l.calori at cineca.it
Fri Feb 13 09:34:56 EST 2009
Philip Lowman ha scritto:
> On Thu, Feb 12, 2009 at 11:43 AM, Luigi Calori <l.calori at cineca.it
> <mailto:l.calori at cineca.it>> wrote:
> Philip Lowman ha scritto:
> add_library(baz STATIC IMPORTED)
> set_target_properties(baz PROPERTIES
> add_library(bar STATIC IMPORTED)
> set_target_properties(bar PROPERTIES
> 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
> Not to take things too off-topic, but I actually like the idea of
> building libjpeg, libtiff, libpng, and even libfreetype within the OSG
> itself just like VTK does, but building them only on Windows platforms
> (especially since Kitware has already "CMakeified" them). If Robert
> has concerns about tarball size these could always be located in a
> separate tarball for releases that Windows users would have to
> download separately. For Linux, though, I think it would be a mistake
> to build these libraries since 99% of distributions have them anyways
> and they are well maintained with bugfixes and security patches.
As I work on vs7.1 I had to cmakify tha basic libs and build from sources.
I currently have a cmake project for building statically:
Looking at CVS vtk site seems that theyr tiff is more recent (3.8.2)
regarding the other, is quite difficult to see the versions.
I' ve tried to keep the lib themself separated from the CMake, so I get
the zip, uncompress in a separate folder and then build.
I also think it would be be better to provide a separate project for
deps, probably using EXPORT/IMPORT stuff
I do not know if VTK utils can be built alone without building VTK.
It would be really nice to have a "standard" way to package source
through CMake, like a cross platform portage.....
> This would get you what you want on WIN32 anyways which is being able
> to use the libraries statically while at the same time it would reduce
> the burden on maintaining the 3rdPartyDeps solution for OSG for every
> possible way of compiling with Visual Studio 7.1, 8.0, or 9.0 (and by
> the way, would you like /MT or /MD with that?).
> In regards to your question though,
> IMPORT/EXPORT looks very interesting for CMake projects, but I really
> haven't used it in this context yet or for importing external
> dependencies (other than "bar" and "baz") to have an opinion on the
> matter. :) I think Bill has some good points about portability. I
> didn't completely understand what you needed STATIC_LIBRARY_FLAGS
> for. In fact part of me still doesn't as I've never needed to clump
> static libraries together for convenience in any of the projects I
> work on.
The question I've posed comes from the fact that I would like to compile
myself the dependencies in a way that mimick OSG Mike prebuilt libs.
As I do have to pack everyting in a firefox plugin I prefer static linking.
The problem is that without using STATIC_LIBRARY_FLAGS hack I obtain a
tiff lib that need jpeg and zlib specified on the link line, and so the
linkage is not consistent to
More information about the CMake