[CMake] Best Practice to determine what type of libraries I am linking to

Mike Jackson mike.jackson at imts.us
Fri Jun 27 10:16:38 EDT 2008


What are the recommended ways to determine what type of libraries my  
application is linking against. An example should explain what I mean.

I use the HDF5 library as part of my project. It can be built either  
as a static or dynamic. If it is built as a static library then I  
don't need to copy it during the install phase. If it is built as a  
dynamic library then I _do_ need to copy it.

Would parsing the HDF5_LIBRARIES variable for a .lib or .dll work?  
Although not sure about that since you link against the .lib on  
windows but use the .dll? This is mainly for Visual Studio use.

Currently there is a #define HDF5_DLL_LIB defined in the H5config.h  
file. I thought of trying a simple try-compile a test file to see if  
it would compile and then base my decision on that.

Other ways? Better ways? Example code?

Thanks
-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services





More information about the CMake mailing list