[CMake] Re: FindSDL.cmake and mingw / msys

E. Wing ewmailing at gmail.com
Fri Mar 23 20:00:30 EST 2007


> > > And if I check all variables using the "show advanced values",
> > > SDL_LIBRARY is nowhere. The only other variable is SDL_LIBRARY_TEMP
> > > showing the value "SDL_LIBRARY_TEMP-NOT-FOUND".
> > >
> > > Any clue?
> >
> > Yeah, this is an artifact of how the script works. The quick answer is
> > to set the SDL_LIBRARY_TEMP with your SDL library. Once you do that,
> > SDL_LIBRARY will be generated.
>
>
> Should a SDL_LIBRARY_INCLUDE and LIBRARY be added to the FindSDL
> module in order to avoid to have to use SDL_LIBRARY_TEMP ?

So I don't understand what SDL_LIBRARY_INCLUDE and SDL_LIBRARY_LIBRARY will do.

But the reason the module is as it is now is that it was trying to
avoid a different problem with configuration. The problem is that the
final SDL_LIBRARY variable is a concatenation of several variables.
Some platforms only need -lSDL, but other platforms have a slew of
things that are needed. So the build system writer doesn't need to
know these details, everything was combined into SDL_LIBRARY so usage
should be consistent across all platforms.

The problem this code was trying to avoid was due to a stale or
incorrect value showing up in the CMakeSetup/ccmake UI. If I used
SDL_LIBRARY directly, and then tried adding the extra things, the
CMake UI doesn't show anything after the initial set so all the extra
flags are invisible. I felt you needed to see the extra stuff in case
the values were wrong or needed changing. (And I think using a FORCE
had some other really nasty problem I can't remember.)

I also considered creating a second value like SDL_LIBRARIES with
directions to use only that one, but I wasn't sure if this should also
have an entry in the UI or not. If it does have an entry, I was
worried it would get confusing and it would also get stale if you
updated/changed SDL_LIBRARY in the UI, but SDL_LIBRARIES was not
up-to-date. If it doesn't, then I was worried people might try adding
the extra needed flags themselves which would create redundant flags.
I also remember that the link order was extremely fragile in certain
cases so I didn't want people touching this if they didn't need to.

The SDL_LIBRARY_TEMP solution comes from something I think Bill
suggested to me. It seemed to work cleaner than the above solutions,
but I overlooked the fact that SDL_LIBRARY_TEMP must be set before
SDL_LIBRARY is created. Still, all-in-all, I think this still an
improvement over the above stuff. Maybe we need to rename the _TEMP
part so it is more clear, or at least document this.

-Eric


More information about the CMake mailing list