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

E. Wing ewmailing at gmail.com
Wed Jul 20 05:22:22 EDT 2005


> > Try this:
> >
> >   -DINCLUDE_DIRECTORIES:STRING=${SDL_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR}

Okay, that seemed to work for my initial case, but I moved my testing
to Windows and I hit another stumbling block which is related to this.
So now I am on my link flags. My line looks like this:
-DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL_LIBRARY}

The problem is that the ${SDL_LIBRARY} flag may be comprised of
multiple variables depending on which compiler and which platform I'm
on. For example, on OS X, it is set like:
SET(SDL_LIBRARY  "-framework SDL -framework Cocoa")

Under Msys on Windows, it is set like
FIND_LIBRARY(SDL_LIBRARY ...)
SET(SDL_LIBRARY ${SDLMAIN_LIBRARY} ${SDL_LIBRARY})
SET(SDL_LIBRARY ${MINGW32_LIBRARY} ${SDL_LIBRARY})
(where it comes out to something like
"mingw32;E:/Libs/libSDLmain.a;E:/Libs/libSDL.dll)

Under Visual Studio, it is similar to Msys, but without the mingw32
and they link to .lib stubs.

${SDL_LIBRARY} tries to hide all this since both the number of flags
and the names of the flags will be different everywhere.

So when I run my ${SDL_LIBRARY} variable through the LINK_LIBRARIES
option, I loose everything except the first entry like I did before.
How do I massage this data so it gets passed correctly?

Thanks,
Eric


More information about the CMake mailing list