Building with cmake

I was wondering if anybody is successfully using cmake to build projects using
sdl, I’ve been investigating it but am running into problems of limited
documentation. I’m trying to use it for a project that I’ve previously compiled
under linux (Ubuntu 6.10) and windows xp, but I can’t seem to get the cmake file
to find sdl. Here’s what I’m using:

PROJECT(DT)
INCLUDE(FindSDL)
INCLUDE(FindOpenGL)

IF(SDL_FOUND)
MESSAGE(“SDL Found”)
INCLUDE_DIRECTORIES(SDL_INCLUDE_DIR)
ELSE(SDL_FOUND)
MESSAGE(“SDL not found”)
ENDIF(SDL_FOUND)

ADD_EXECUTABLE(dt DTpath.cpp DT.cpp)

I haven’t got as far as telling it to link against the opengl and sdl libs yet,
becuase it says it can’t find sdl.
If anybody has any helpful suggestions regarding this issue I’d be grateful for
the assistance.
Regards,
Dan

My finger prints are all over the FindSDL module. What platform are
you on, what are the file name of your SDL library, and where on your
system are they located?

-EricOn 3/3/07, Dan <dan.newmarch at gmail.com> wrote:

I was wondering if anybody is successfully using cmake to build projects
using
sdl, I’ve been investigating it but am running into problems of limited
documentation. I’m trying to use it for a project that I’ve previously
compiled
under linux (Ubuntu 6.10) and windows xp, but I can’t seem to get the cmake
file
to find sdl. Here’s what I’m using:

PROJECT(DT)
INCLUDE(FindSDL)
INCLUDE(FindOpenGL)

IF(SDL_FOUND)
MESSAGE(“SDL Found”)
INCLUDE_DIRECTORIES(SDL_INCLUDE_DIR)
ELSE(SDL_FOUND)
MESSAGE(“SDL not found”)
ENDIF(SDL_FOUND)

ADD_EXECUTABLE(dt DTpath.cpp DT.cpp)

I haven’t got as far as telling it to link against the opengl and sdl libs
yet,
becuase it says it can’t find sdl.
If anybody has any helpful suggestions regarding this issue I’d be grateful
for
the assistance.
Regards,
Dan


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

E. Wing <ewmailing gmail.com> writes:

My finger prints are all over the FindSDL module. What platform are
you on, what are the file name of your SDL library, and where on your
system are they located?

-Eric

I was wondering if anybody is successfully using cmake to build projects
using
sdl, I’ve been investigating it but am running into problems of limited
documentation. I’m trying to use it for a project that I’ve previously
compiled
under linux (Ubuntu 6.10) and windows xp, but I can’t seem to get the cmake
file
to find sdl. Here’s what I’m using:

PROJECT(DT)
INCLUDE(FindSDL)
INCLUDE(FindOpenGL)

IF(SDL_FOUND)
MESSAGE(“SDL Found”)
INCLUDE_DIRECTORIES(SDL_INCLUDE_DIR)
ELSE(SDL_FOUND)
MESSAGE(“SDL not found”)
ENDIF(SDL_FOUND)

ADD_EXECUTABLE(dt DTpath.cpp DT.cpp)

I haven’t got as far as telling it to link against the opengl and sdl libs
yet,
becuase it says it can’t find sdl.
If anybody has any helpful suggestions regarding this issue I’d be grateful
for
the assistance.
Regards,
Dan


SDL mailing list
SDL lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Eric,
Thanks for replying so quickly, as it turns out, SDL wasn’t even installed, I
was just coming back to post an apology. I forgot that I had done a system
reinstall since I last compiled the code I’m working on, and hadn’t installed
the sdl-dev packages yet.

I do have a follow up question though, because while it’s adding the sdl include
path properly now, when I try to link against it using
TARGET_LINK_LIBRARIES(dt m SDL_LIBRARY OPENGL_LIBRARIES)
the linker fails saying it can’t find -lSDL_LIBRARY.
If your questions are still relevant, I’m using ubuntu 6.10, I’ve just installed
the repo packages so it’s version 1.2.10, the headers are located
/usr/include/SDL and the libraries are located in /usr/lib
Thanks for the help,
Dan> On 3/3/07, Dan <dan.newmarch gmail.com> wrote:

You need to use the variable ${} syntax when appropriate, as in ${SDL_LIBRARY}.On 3/3/07, Dan <dan.newmarch at gmail.com> wrote:

E. Wing <ewmailing gmail.com> writes:

My finger prints are all over the FindSDL module. What platform are
you on, what are the file name of your SDL library, and where on your
system are they located?

-Eric

On 3/3/07, Dan <dan.newmarch gmail.com> wrote:

I was wondering if anybody is successfully using cmake to build projects
using
sdl, I’ve been investigating it but am running into problems of limited
documentation. I’m trying to use it for a project that I’ve previously
compiled
under linux (Ubuntu 6.10) and windows xp, but I can’t seem to get the
cmake

file
to find sdl. Here’s what I’m using:

PROJECT(DT)
INCLUDE(FindSDL)
INCLUDE(FindOpenGL)

IF(SDL_FOUND)
MESSAGE(“SDL Found”)
INCLUDE_DIRECTORIES(SDL_INCLUDE_DIR)
ELSE(SDL_FOUND)
MESSAGE(“SDL not found”)
ENDIF(SDL_FOUND)

ADD_EXECUTABLE(dt DTpath.cpp DT.cpp)

I haven’t got as far as telling it to link against the opengl and sdl
libs

yet,
becuase it says it can’t find sdl.
If anybody has any helpful suggestions regarding this issue I’d be
grateful

for
the assistance.
Regards,
Dan


SDL mailing list
SDL lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Eric,
Thanks for replying so quickly, as it turns out, SDL wasn’t even installed,
I
was just coming back to post an apology. I forgot that I had done a system
reinstall since I last compiled the code I’m working on, and hadn’t
installed
the sdl-dev packages yet.

I do have a follow up question though, because while it’s adding the sdl
include
path properly now, when I try to link against it using
TARGET_LINK_LIBRARIES(dt m SDL_LIBRARY OPENGL_LIBRARIES)
the linker fails saying it can’t find -lSDL_LIBRARY.
If your questions are still relevant, I’m using ubuntu 6.10, I’ve just
installed
the repo packages so it’s version 1.2.10, the headers are located
/usr/include/SDL and the libraries are located in /usr/lib
Thanks for the help,
Dan


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

E. Wing <ewmailing gmail.com> writes:

You need to use the variable ${} syntax when appropriate, as in ${SDL_LIBRARY}.

That makes a ton of sense, thanks heaps mate,
Dan

I was wondering if anybody is successfully using cmake to build projects using
sdl, I’ve been investigating it but am running into problems of limited
documentation. I’m trying to use it for a project that I’ve previously compiled
under linux (Ubuntu 6.10) and windows xp, but I can’t seem to get the cmake file
to find sdl. Here’s what I’m using:

Here’s what I’m using with my project named “Toby” … I don’t have the
INCLUDE() statement in mine. I’m also on the latest stable CMake release
(most of the Linux distros that package CMake are on an obsolete
versions…once they all start upgrading KDE, CMake will probably get
upgraded in distros, too).

OPTION(TOBY_GUI_SDL “Build SDL standalone GUI” TRUE)
IF(TOBY_GUI_SDL)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
SET(TOBY_HAVE_GUI TRUE)
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
ELSE(SDL_FOUND)
MESSAGE(STATUS “SDL not found. Support is disabled.”)
SET(TOBY_GUI_SDL FALSE)
ENDIF(SDL_FOUND)
ENDIF(TOBY_GUI_SDL)

later on in the CMakeLists.txt …

IF(TOBY_GUI_SDL)
ADD_EXECUTABLE(toby-sdl toby_sdl.c)
TARGET_LINK_LIBRARIES(toby-sdl tobybackend ${OPTIONAL_LIBS}
${SDL_LIBRARY})
ENDIF(TOBY_GUI_SDL)

–ryan.