[CMake] how to select static libraries for linking?

Mike Jackson mike.jackson at bluequartz.net
Thu Jun 11 20:30:33 EDT 2009


James,
   If you distribute on OS X then there are some CMake facilities to
help you create a stand alone .app bundle. Basically it will run
"install_name_tool" on the dylibs to make sure they reference
dependent libraries that are stored inside the .app bundle. Usually
this is a real pain to do by hand due to the dependency tree for each
library that needs to be taken into account.

here is an example that does just that using the Qt libraries as an example:

http://www.bluequartz.net/software/files/QtTest.zip


 On windows I would build with static libraries if at all possible.

Mike

On Thu, Jun 11, 2009 at 7:05 PM, James C.
Sutherland<James.Sutherland at utah.edu> wrote:
>
> On Jun 11, 2009, at 4:49 PM, James C. Sutherland wrote:
>
>> I have an executable that links with HDF5 (by the way, is there any plan
>> to create a "FindHDF5.cmake" file?).
>> The problem is that I have two flavors of libraries:
>>        libhdf5_cpp.a           libhdf5.a
>>        libhdf5_cpp.dylib       libhdf5.dylib
>> When I do
>>  set( HDF5_LIBRARIES hdf5_cpp hdf5 )
>> it seems that CMake ends up choosing the *.dylib rather than the *.a
>> versions.  Is there a way to fix this so that I link statically?
>>
>
> Well, I tried
>         set( HDF5_LIBRARIES hdf5_cpp.a hdf5.a )
> and that partly did the job.  It appears that somehow some other hdf5 dlls
> were being pulled in (hdf5_cpp.0.dylib).
>
> I would like to generate executables that can be run on other systems, but
> the problem is these DLLs are killing me!  Any tips would be great.


More information about the CMake mailing list