--- CMakeLists.txt.orig	2007-07-12 20:18:26 UTC
+++ CMakeLists.txt
@@ -12,6 +12,8 @@
 # into current directory and run ./Memonix
 #
 
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+
 # project name
 PROJECT(Memonix)
 
@@ -29,11 +31,15 @@ FIND_PACKAGE(GLU REQUIRED)
 FIND_PACKAGE(SDL REQUIRED)
 FIND_PACKAGE(SDL_image REQUIRED)
 FIND_PACKAGE(SDL_mixer REQUIRED)
+FIND_PACKAGE(X11 REQUIRED)
 
 # sources
-FILE(GLOB_RECURSE memonix_SRCS *.cpp)
+FILE(GLOB_RECURSE memonix_SRCS src/*.cpp)
 
 # targets
-ADD_DEFINITIONS(`${SDL_CONFIG} --cflags`)
+EXEC_PROGRAM(${SDL_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE SDL_CFLAGS)
+EXEC_PROGRAM(${SDL_CONFIG} ARGS "--libs" OUTPUT_VARIABLE SDL_LIBS)
+
+ADD_DEFINITIONS(${SDL_CFLAGS})
 ADD_EXECUTABLE(Memonix ${memonix_SRCS})
-TARGET_LINK_LIBRARIES(Memonix `${SDL_CONFIG} --libs` ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${OPENGL_gl_LIBRARY} ${GLU_LIBRARY})
+TARGET_LINK_LIBRARIES(Memonix ${SDL_LIBS} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${OPENGL_gl_LIBRARY} ${GLU_LIBRARY} ${X11_LIBRARIES})
