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

E. Wing ewmailing at gmail.com
Mon Jul 18 16:03:42 EDT 2005


On 7/18/05, William A. Hoffman <billlist at nycap.rr.com> wrote:
> 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?
> 

Currently, there is no configuration file like wx-config as far as I
know. I think it's on a TODO list somewhere. There are reports that
the autoconf system is unreliable/not working for systems other than
Linux anyway. I know the author hates autoconf so I don't think he's
very motivated to fix it. (I don't blame him either.) I've been
kicking around the idea of writing a CMake based system for it and I
think he likes the idea, but until I can get CMake to build native OS
X frameworks,  I haven't been  willing enough to make that commitment.

SDL_sound is a realitvely young library and my impression is that it
has a very small community. People like me have been contributing
Visual Studio and Xcode projects that are hand crafted. So even if
there was a sdlsound-config script, I doubt very much it would get
deployed for Windows and OS X in a consistent and useful manner.

So for right now, getting this stuff built has been an exercise left
to the user. Until recently, I think most of the people using SDL
sound built it themselves and didn't worry about others needing to
compile their stuff. The ones who did might statically link in all the
other library dependencies directly into SDL_sound and then
dynamically link against it (to remain LGPL compliant). But I'm
starting to see SDL_sound in distros. And for my own projects, I keep
forgetting how I compiled it (and it's different for each platform
depending on which source code I can actually get compiled). So I
would like to solve this problem.

So could you elaborate on how I would use the TRY_COMPILEs? My first
problem is that the TRY_COMPILE needs to specify the include paths for
SDL.h and SDL_sound.h. So I need to essentially run a FIND_INCLUDE
first and pass it to TRY_COMPILE. In addition, I need to also
essentially do a FIND_LIBRARY on SDL and SDL_sound (for -lSDL or
-framework SDL_sound, etc) so I can get far enough in the link process
so it can complain about the 3rd party symbols and not the SDL
symbols. I'm not sure how to pass any of this to the TRY_COMPILE. I
looked at the COMPILE_DEFINITIONS, but the documentation said it was
only for -D flags. I tried using it anyway...my -I flags, but the
-framework/-l flags were disregarded because they were used too early
in the compile process.

I'm also unsure what to expect in the OUTPUT_VARIABLE and how I can
interpret the output in a general enough way to deal with cross
platform issues. Do you have any suggestions here?

Thanks,
Eric


More information about the CMake mailing list