[CMake] Figuring out dependencies for a library in order to build

William A. Hoffman billlist at nycap.rr.com
Mon Jul 18 10:23:17 EDT 2005


I suppose the only way to do this would be to use try-compiles or if
there is some sort of configuration file that you can read from the
package itself.  For example wx windows has a script wx-config that tells
you what flags and libraries to link.   How are users of the SDL_sound
supposed to do this stuff without CMake?



At 07:27 AM 7/16/2005, E. Wing wrote:
>I'm trying to write Find_X.cmake modules for some libraries I depend
>on. However, these libraries are a bit more complicated than what I'm
>used to dealing with because they potentially depend on other
>libraries. The problem is the dependencies the main library has can
>vary depending on how it was compiled, which is information I don't
>know ahead of time. I would like to write a Find cmake module that can
>figure out which dependencies are needed to allow my program to
>compile.
>
>As a concrete example, SDL_sound represents one of these libraries I'm
>trying to write a module for. SDL_sound is a decoder library and
>unified interface for some popular sound formats. To support
>additional formats, SDL_sound may dynamically link against a variety
>of different libraries. This is where my problem begins. When I move
>from computer to computer, distro to distro, platform to platform,
>every system may have a differently built SDL_sound. So for example,
>SDL_sound might link to Ogg Vorbis on one system, but not on another
>system. Another example is that SDL_sound might link to MikMod for
>.mod support on one system, but links to ModPlug for .mod support on
>another system, and a third system might actually link to both MikMod
>and ModPlug.
>
>In order for my program which uses SDL_sound to successfully build, I
>must also explicitly link against all the libraries that SDL_sound
>depends on with compilers like gcc. I think with Visual Studio, I may
>have managed to build without these explicit links, but my memory
>might be playing tricks on me. So I would like to be able to figure
>out the minimal set of dependencies I need to allow my stuff to build.
>
>Is there a way I can accomplish this with CMake? Are there any
>examples of this I can look at?
>
>Thanks,
>Eric
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake 



More information about the CMake mailing list