Philip Lowman wrote:
On Mon, Feb 9, 2009 at 12:39 PM, Luigi Calori <l.cal...@cineca.it
<mailto:l.cal...@cineca.it>> wrote:
I' m quite a newbie in static linking, I would like to combine two lib
into one:
say libtiff needs libjpeg and zlib
If you generate them separately, then when you build an executable that
needs libtiff, you have to link also libjpeg and zlib otherwise unref
happens
It is possible, under VisualStudio interface, to specify libjpeg.lib and
zlib.lib as Additional Dependencies
This way (even if the linker show warnings as duplicate symbols) I
obtain a libtiff that can be used alone.
My question is: can I obtain the same result with cmake?
I' ve tried to use TARGET_LINK_LIBRARIES, that is perfecly working for
exe and SHARED linkage but no success: the
vs project has always the Additional Dependencies field empty.
Am I completely missing something?
CMake does not work that way since it is not achievable cross platform.
If you project is CMake based CMake will chain the libraries. If you
use other build tools then you will have to explicitly list libjpeg and
zlib with the libtiff. To do this in CMake you have two options:
1. have a library that uses libtiff
add_library(mylib ...)
target_link_libraries(mylib libtiff libjepg zlib)
add_executable(myexe ...)
target_link_libraries(myexe mylib) # will link in tiff jpeg and zlib
2. create an imported target for libtiff
add_library(libtiff IMPORTED)
set_target_properties(libtiff PROPERTIES IMPORTED_LOCATION
/path/to/libtiff.lib)
target_link_libraries(libtiff libjpeg zlib)
add_executable(myexe ...)
target_link_libraries(myexe libtiff) # will link jpeg and zlib
-Bill
_______________________________________________
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