Philip Lowman ha scritto:
On Thu, Feb 12, 2009 at 11:43 AM, Luigi Calori <l.cal...@cineca.it
<mailto:l.cal...@cineca.it>> wrote:
Philip Lowman ha scritto:
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
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:
tiff-3.7.4
zlib-1.2.3
libpng-1.2.24
jpeg-6b
freetype-2.3.5
curl-7.18.1
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
everyone else.
Regards
Luigi
_______________________________________________
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