[CMake] FindSDL.cmake on windows

Philip Lowman philip at yhbt.com
Sun Nov 2 19:23:37 EST 2008


On Wed, Oct 29, 2008 at 11:34 AM, Christopher Harvey <chris at basementcode.com
> wrote:

> Hi list,
> I just tried FindSDL today. Works great under linux, however under
> windows it doesn't seem to do anything at all. My SDL library is
> installed in a non-standard location (is there a standard location on
> windows?)
>
> Here is my CMakeLists.txt layout:
>
> FIND_PACKAGE(SDL)
> ...
> ...
> IF(SDL_FOUND)
>  ADD_SUBDIRECTORY(exmapleApp)
> ENDIF(SDL_FOUND)
>
>
> So naturally under windows FIND_PACKAGE fails, no problem there.
> I was surprised to see that  even if I filled out the SDL path
> information in the GUI configuration program and ran configure again
> that the project still remained excluded from the project. Is there a
> way to let the user help find sdl, then configure so that the exampleApp
> is included in the build?


You can provide a cache variable for the end user and then abuse
CMAKE_PREFIX_PATH to suggest a location to find the SDL.

set(SDL_ROOT "" CACHE PATH "The location of the SDL install prefix (only
used if the SDL is not yet found)")
if(SDL_ROOT)
   set(CMAKE_PREFIX_PATH ${SDL_ROOT})
endif()
FIND_PACKAGE(SDL)


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081102/0044c4d3/attachment.htm>


More information about the CMake mailing list