Hi, I have yet another static library order question when using target_link_libraries
In my case, I've developed a new FindHDF5.cmake that calls the hdf5 compiler
wrapper and sets the usual variables
HDF5_<lang>_COMPILE_FLAGS, HDF5_<lang>_INCLUDE_PATH, HDF5_<lang>_LINK_FLAGS
and HDF5_<lang>_LIBRARIES
In my application I'm using both C and Fortran so I'm adding the libraries
with:
target_link_libraries(myapp ${HDF5_C_LIBRARIES} ${HDF5_Fortran_LIBRARIES})
I'm using this on a bluegene/q computer where the found libraries are
HDF5_Fortran_LIBRARIES:
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5hl_fortran.a
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5_hl.a
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5_fortran.a
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5.a
/usr/local/szip/lib/libsz.a;/usr/local/zlib/lib/libz.a
/bgsys/drivers/toolchain/V1R2M0/gnu-linux/powerpc64-bgq-linux/lib/librt.a
/bgsys/drivers/toolchain/V1R2M0/gnu-linux/powerpc64-bgq-linux/lib/libm.a
HDF5_C_LIBRARIES:
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5_hl.a
/usr/local/hdf5/v1.8.10p1_serial/lib/libhdf5.a
/usr/local/szip/lib/libsz.a;/usr/local/zlib/lib/libz.a
/bgsys/drivers/toolchain/V1R2M0/gnu-linux/powerpc64-bgq-linux/lib/librt.a
/bgsys/drivers/toolchain/V1R2M0/gnu-linux/powerpc64-bgq-linux/lib/libm.a
the order match the dependencies:
hdf5hl_fortran -> hdf5_hl + hdf5_fortran + hdf5
hdf5_hl -> hdf5
hdf5_fortran -> hdf5
However cmake removes duplicates from the library list in
target_link_libraries ... unfortunately, it leaves the first duplicate and
rmoves the following ones which results in the order
"hdf5_hl hdf5 hdf5hl_fortran hdf5_fortran"
That doesn't work due to the dependencies
hdf5hl_fortran -> hdf5_hl + hdf5
hdf5_fortran -> hdf5
I don't get what I'm doing wrong here (apart from trying to use both static
libs and cmake :/ ) ...
For now I've worked around this problem by putting the C libs after the
fortran ones in the call to target_link_libraries but I don't want to
distribute my module with this limitation ...
Could someone help me there ?
Regards,
--
Julien Bigot, Ph.D. -- http://work.julien-bigot.fr
Maison de la Simulation USR 3441 - bât. 565 - CEA Saclay
91191 Gif-sur-Yvette CEDEX - FRANCE
phone: (+33) 1 69 08 01 75 -- xmpp: [email protected]
signature.asc
Description: This is a digitally signed message part.
-- 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
