change eol-style to native on CMakeLists.txt
authorTim Goya <tuxdev103@gmail.com>
Wed, 22 Oct 2008 18:27:57 +0000 (18:27 +0000)
committerTim Goya <tuxdev103@gmail.com>
Wed, 22 Oct 2008 18:27:57 +0000 (18:27 +0000)
SVN-Revision: 5800

CMakeLists.txt

index e6b70a7..b8b3c41 100644 (file)
-#\r
-# SuperTux - root build script\r
-# Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>\r
-#\r
-# This program is free software; you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation; either version 2 of the License, or\r
-# (at your option) any later version.\r
-# \r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-#\r
-\r
-\r
-#\r
-# INSTRUCTIONS:\r
-# -------------\r
-#\r
-# Create a directory build/ and change to it. Run\r
-#\r
-#   cmake ..\r
-#\r
-# This creates a set of Makefiles to build the project. Run\r
-#\r
-#   make\r
-#\r
-\r
-\r
-## Project name to use as command prefix\r
-\r
-PROJECT(SUPERTUX)\r
-\r
-\r
-### CMake configuration\r
-\r
-# allow building with old CMake. Use some bundled modules as a fallback\r
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)\r
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SUPERTUX_SOURCE_DIR}/mk/cmake)\r
-\r
-# move some config clutter to the advanced section\r
-MARK_AS_ADVANCED(\r
-       CMAKE_BACKWARDS_COMPATIBILITY\r
-       CMAKE_BUILD_TYPE\r
-       CMAKE_INSTALL_PREFIX\r
-       EXECUTABLE_OUTPUT_PATH\r
-       LIBRARY_OUTPUT_PATH\r
-       CMAKE_OSX_ARCHITECTURES\r
-       CMAKE_OSX_SYSROOT\r
-)\r
-\r
-## For autopackage\r
-MARK_AS_ADVANCED(\r
-       ENABLE_BINRELOC\r
-       APPDATADIR\r
-)\r
-OPTION(ENABLE_BINRELOC "Enable autopackage's BINRELOC features" OFF)\r
-SET(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/games/supertux2")\r
-\r
-## Check endianess\r
-\r
-INCLUDE(TestBigEndian)\r
-TEST_BIG_ENDIAN(WORDS_BIGENDIAN)\r
-\r
-## Add lots of dependencies to compiler switches\r
-\r
-FIND_PACKAGE(SDL REQUIRED)\r
-MARK_AS_ADVANCED(\r
-       SDLMAIN_LIBRARY\r
-       SDL_INCLUDE_DIR\r
-       SDL_LIBRARY\r
-)\r
-INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})\r
-\r
-FIND_PACKAGE(SDL_image REQUIRED)\r
-MARK_AS_ADVANCED(\r
-       SDLIMAGE_INCLUDE_DIR\r
-       SDLIMAGE_LIBRARY\r
-)\r
-INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})\r
-\r
-OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)\r
-IF(ENABLE_OPENGL)\r
-  FIND_PACKAGE(OpenGL)\r
-  IF(${OPENGL_FOUND} STREQUAL "YES")\r
-    INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})\r
-    SET(HAVE_OPENGL TRUE)\r
-  ENDIF(${OPENGL_FOUND} STREQUAL "YES")\r
-ENDIF(ENABLE_OPENGL)\r
-\r
-FIND_PACKAGE(OpenAL REQUIRED)\r
-MARK_AS_ADVANCED(\r
-       OPENAL_INCLUDE_DIR\r
-       OPENAL_LIBRARY\r
-)\r
-INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})\r
-\r
-FIND_PACKAGE(OggVorbis REQUIRED)\r
-MARK_AS_ADVANCED(\r
-       OGG_LIBRARY\r
-       VORBISENC_LIBRARY\r
-       VORBISFILE_LIBRARY\r
-       VORBIS_INCLUDE_DIR\r
-       VORBIS_LIBRARY\r
-)\r
-INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIR})\r
-\r
-FIND_PACKAGE(PhysFS REQUIRED)\r
-MARK_AS_ADVANCED(\r
-       PHYSFS_INCLUDE_DIR\r
-       PHYSFS_LIBRARY\r
-)\r
-INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR})\r
-\r
-FIND_PACKAGE(CURL)\r
-IF(CURL_FOUND)\r
-  INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})\r
-  SET(HAVE_LIBCURL TRUE)\r
-ENDIF(CURL_FOUND)\r
-\r
-#FIND_PACKAGE(ICONV REQUIRED)\r
-#INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})\r
-#LINK_LIBRARIES(${ICONV_LIBRARY})\r
-\r
-## Find revision of WC\r
-FIND_PACKAGE(Subversion)\r
-IF(Subversion_FOUND)\r
-  Subversion_WC_INFO(${SUPERTUX_SOURCE_DIR} SUPERTUX)\r
-  SET(REVISION " r${SUPERTUX_WC_REVISION}")\r
-ENDIF(Subversion_FOUND)\r
-\r
-## Check platform-dependent build options\r
-\r
-INCLUDE(ConfigureChecks)\r
-\r
-## Create config.h\r
-\r
-configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )\r
-include_directories (${CMAKE_BINARY_DIR}/)\r
-\r
-## Also execute instructions in src/squirrel/CMakeLists.txt\r
-\r
-ADD_SUBDIRECTORY(src/squirrel)\r
-\r
-## Add squirrel lib dir to search path\r
-\r
-LINK_DIRECTORIES(src/squirrel)\r
-\r
-## Some additional include paths\r
-\r
-include_directories (${SUPERTUX_SOURCE_DIR}/src/)\r
-include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/include/)\r
-\r
-## Build list of sources for supertux binary\r
-\r
-FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/*/*.cpp src/obstack/*.c)\r
-\r
-## Precompile "a few" headers in GCC\r
-OPTION(PRECOMPILE_HEADERS "Precompile headers (experimental)" OFF)\r
-IF(PRECOMPILE_HEADERS)\r
-  FILE(GLOB PRECOMPILED_HEADERS RELATIVE ${SUPERTUX_SOURCE_DIR} src/badguy/badguy.hpp\r
-           src/scripting/wrapper.hpp src/video/*.hpp src/math/*.hpp)\r
-  FILE(WRITE ${SUPERTUX_BINARY_DIR}/precompile.hh "// Precompiled headers\n")\r
-  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#ifndef __SUPERTUX_PRECOMPILED_HEADER\n")\r
-  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#define __SUPERTUX_PRECOMPILED_HEADER\n")\r
-  FOREACH(PRECOMPILED_HEADER ${PRECOMPILED_HEADERS})\r
-    FILE(RELATIVE_PATH PRECOMPILED_HEADER ${SUPERTUX_SOURCE_DIR}/src "${SUPERTUX_SOURCE_DIR}/${PRECOMPILED_HEADER}")\r
-    FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#include \"${PRECOMPILED_HEADER}\"\n")\r
-  ENDFOREACH(PRECOMPILED_HEADER)\r
-  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#endif /*__SUPERTUX_PRECOMPILED_HEADER*/\n")\r
-  ADD_CUSTOM_COMMAND(\r
-    OUTPUT ${SUPERTUX_BINARY_DIR}/precompile.hh.gch\r
-    COMMAND ${CMAKE_CXX_COMPILER} -x "c++-header" $(CXX_FLAGS) ${SUPERTUX_BINARY_DIR}/precompile.hh\r
-    DEPENDS ${PRECOMPILED_HEADERS}\r
-    COMMENT "Building precompiled header..."\r
-  )\r
-  ## Make certain it is built\r
-  SET(SUPERTUX_SOURCES ${SUPERTUX_BINARY_DIR}/precompile.hh.gch ${SUPERTUX_SOURCES})\r
-  SET(CMAKE_CXX_FLAGS "-include ${SUPERTUX_BINARY_DIR}/precompile.hh" ${CMAKE_CXX_FLAGS})\r
-ELSE(PRECOMPILE_HEADERS)\r
-  IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)\r
-    FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh)\r
-  ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)\r
-  IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)\r
-    FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)\r
-  ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)\r
-ENDIF(PRECOMPILE_HEADERS)\r
-\r
-\r
-## Debug options\r
-\r
-OPTION(DEBUG "Build with debugging options" OFF)\r
-OPTION(PROFILE "Build with profiling information" OFF)\r
-OPTION(WERROR "Stops on first compiler warning in debug mode" ON)\r
-IF(CMAKE_COMPILER_IS_GNUCC)\r
-  ADD_DEFINITIONS(-Wall -W)\r
-  IF (DEBUG)\r
-    REMOVE_DEFINITIONS(-O2)\r
-    ADD_DEFINITIONS(-O0 -g)\r
-    IF(WERROR)\r
-      ADD_DEFINITIONS(-Werror)\r
-    ENDIF(WERROR)\r
-  ELSE (DEBUG)\r
-    ADD_DEFINITIONS(-O2)\r
-    REMOVE_DEFINITIONS(-O0 -g)\r
-  ENDIF (DEBUG)\r
-  IF (PROFILE)\r
-    ADD_DEFINITIONS(-pg)\r
-  ELSE (PROFILE)\r
-    REMOVE_DEFINITIONS(-pg)\r
-  ENDIF (PROFILE)\r
-ENDIF(CMAKE_COMPILER_IS_GNUCC)\r
-\r
-## Add in squirrel debug stuff\r
-\r
-OPTION(ENABLE_SQDBG "Build squirrel script interpreter with debugging options" OFF)\r
-IF(ENABLE_SQDBG)\r
-  include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/)\r
-  FILE(GLOB SQDBG_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/squirrel/sqdbg/*.cpp)\r
-  SET(SUPERTUX_SOURCES ${SQDBG_SOURCES} ${SUPERTUX_SOURCES})\r
-ENDIF(ENABLE_SQDBG)\r
-\r
-## Build miniswig and generate miniswig wrapper\r
-\r
-OPTION(GENERATE_WRAPPER "Build miniswig and generate the wrapper" ${DEBUG})\r
-IF(GENERATE_WRAPPER)\r
-  ADD_SUBDIRECTORY(tools/miniswig)\r
-  FILE(GLOB GENERATE_WRAPPER_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/scripting/*.?pp)\r
-  LIST(REMOVE_ITEM GENERATE_WRAPPER_SOURCES "src/scripting/wrapper.cpp" "src/scripting/wrapper.hpp")\r
-  ADD_CUSTOM_COMMAND(\r
-    OUTPUT ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp\r
-    COMMAND cd ${SUPERTUX_SOURCE_DIR} && ${CMAKE_CXX_COMPILER}\r
-    ARGS -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o ${SUPERTUX_BINARY_DIR}/miniswig.tmp\r
-    COMMAND tools/miniswig/miniswig\r
-    ARGS --input miniswig.tmp --output-cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace Scripting\r
-    DEPENDS ${GENERATE_WRAPPER_SOURCES} tools/miniswig/miniswig\r
-  )\r
-ENDIF(GENERATE_WRAPPER)\r
-\r
-IF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)\r
-  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)\r
-ENDIF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)\r
-\r
-## If xgettext is available, generate messages.pot for sources\r
-\r
-OPTION(GENERATE_MESSAGESPOT "Generate messages.pot files" ${DEBUG})\r
-IF(GENERATE_MESSAGESPOT)\r
-  MARK_AS_ADVANCED(\r
-    XGETTEXT_EXECUTABLE\r
-  )\r
-  FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)\r
-  IF(NOT XGETTEXT_EXECUTABLE)\r
-    MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot")\r
-  ELSE(NOT XGETTEXT_EXECUTABLE)\r
-    MESSAGE(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")\r
-\r
-    SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot)\r
-    ADD_CUSTOM_COMMAND(\r
-      OUTPUT ${MESSAGES_POT_FILE}\r
-      COMMAND ${XGETTEXT_EXECUTABLE}\r
-      ARGS --keyword=_ --language=C++ --output=${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES}\r
-      DEPENDS ${SUPERTUX_SOURCES}\r
-      WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}\r
-      COMMENT "Generating POT file ${MESSAGES_POT_FILE}"\r
-    )\r
-    LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})\r
-\r
-    FILE(GLOB SUPERTUX_LEVEL_DIRS RELATIVE ${SUPERTUX_SOURCE_DIR} data/levels/*)\r
-    LIST(REMOVE_ITEM SUPERTUX_LEVEL_DIRS "data/levels/.svn")\r
-    FOREACH(SUPERTUX_LEVEL_DIR ${SUPERTUX_LEVEL_DIRS})\r
-      FILE(GLOB SUPERTUX_LEVELS RELATIVE ${SUPERTUX_SOURCE_DIR} ${SUPERTUX_LEVEL_DIR}/*.stl ${SUPERTUX_LEVEL_DIR}/*.stwm ${SUPERTUX_LEVEL_DIR}/*.txt)\r
-\r
-      ## Do not add target if SUPERTUX_LEVELS is empty. This is needed for cmake <=2.4\r
-      IF(SUPERTUX_LEVELS)\r
-      SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/${SUPERTUX_LEVEL_DIR}/messages.pot)\r
-      ADD_CUSTOM_COMMAND(\r
-        OUTPUT ${MESSAGES_POT_FILE}\r
-        COMMAND ${XGETTEXT_EXECUTABLE}\r
-        ARGS --keyword="_:1" --language=Lisp --sort-by-file --output=${MESSAGES_POT_FILE} ${SUPERTUX_LEVELS}\r
-        DEPENDS ${SUPERTUX_LEVELS}\r
-        WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}\r
-        COMMENT "Generating POT file ${MESSAGES_POT_FILE}"\r
-      )\r
-      LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})\r
-      ENDIF(SUPERTUX_LEVELS)\r
-\r
-    ENDFOREACH(SUPERTUX_LEVEL_DIR)\r
-\r
-    ADD_CUSTOM_TARGET(\r
-      supertux2-messages ALL \r
-      DEPENDS ${MESSAGES_POT_FILES}\r
-    )\r
-\r
-  ENDIF(NOT XGETTEXT_EXECUTABLE)\r
-ENDIF(GENERATE_MESSAGESPOT)\r
-\r
-## Some additional compiler switches\r
-IF(CMAKE_COMPILER_IS_GNUCC)\r
-  ADD_DEFINITIONS(-fno-strict-aliasing)\r
-ENDIF(CMAKE_COMPILER_IS_GNUCC)\r
-\r
-IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-  ADD_DEFINITIONS(-DMACOSX)\r
-ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-\r
-\r
-## On Windows, add an icon\r
-\r
-IF(WIN32)\r
-  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.rc)\r
-  IF(MINGW)\r
-    ADD_CUSTOM_COMMAND(\r
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o\r
-    COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons -i${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc -o ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)\r
-    SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)\r
-  ELSE(MINGW)\r
-    SET(SUPERTUX_EXE_SRCS ${SUPERTUX_EXE_SRCS} supertux.rc)\r
-  ENDIF(MINGW)\r
-ENDIF(WIN32)\r
-\r
-## Add binreloc.c if enabled\r
-IF(ENABLE_BINRELOC)\r
-  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/src/binreloc/binreloc.c)\r
-ENDIF(ENABLE_BINRELOC)\r
-\r
-\r
-## Generate supertux executable in the right place\r
-\r
-SET(EXECUTABLE_OUTPUT_PATH ${SUPERTUX_SOURCE_DIR})\r
-\r
-## Add target for supertux binary\r
-\r
-ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES})\r
-\r
-## Link supertux binary with squirrel and other libraries\r
-\r
-TARGET_LINK_LIBRARIES(supertux2 squirrel)\r
-TARGET_LINK_LIBRARIES(supertux2 ${SDL_LIBRARY})\r
-TARGET_LINK_LIBRARIES(supertux2 ${SDLIMAGE_LIBRARY})\r
-TARGET_LINK_LIBRARIES(supertux2 ${OPENAL_LIBRARY})\r
-TARGET_LINK_LIBRARIES(supertux2 ${OGGVORBIS_LIBRARIES})\r
-TARGET_LINK_LIBRARIES(supertux2 ${PHYSFS_LIBRARY})\r
-IF(HAVE_OPENGL)\r
-    TARGET_LINK_LIBRARIES(supertux2 ${OPENGL_LIBRARY})\r
-ENDIF(HAVE_OPENGL)\r
-IF(HAVE_LIBCURL)\r
-  TARGET_LINK_LIBRARIES(supertux2 ${CURL_LIBRARY})\r
-ENDIF(HAVE_LIBCURL)\r
-\r
-## Install stuff\r
-\r
-IF(WIN32 AND NOT UNIX)\r
-\r
-  SET(INSTALL_SUBDIR_BIN ".")\r
-  SET(INSTALL_SUBDIR_SHARE "data/")\r
-  SET(INSTALL_SUBDIR_DOC ".")\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/SDL.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/SDL_image.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/iconv.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libogg-0.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libphysfs-1-0-0.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/OpenAl32.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/wrap_oal.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libcurl-4.dll DESTINATION ${INSTALL_SUBDIR_BIN})\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")\r
-\r
-ELSE(WIN32 AND NOT UNIX)\r
-IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-\r
-  SET(INSTALL_SUBDIR_BIN "SuperTux.app/Contents/MacOS/")\r
-  SET(INSTALL_SUBDIR_SHARE "SuperTux.app/Contents/Resources/data/")\r
-  SET(INSTALL_SUBDIR_DOC "SuperTux.app/Contents/Resources/")\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/tools/darwin/info.plist DESTINATION "SuperTux.app/Contents/")\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.icns DESTINATION "SuperTux.app/Contents/Resources/")\r
-\r
-ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-\r
-  SET(INSTALL_SUBDIR_BIN "games/")\r
-  SET(INSTALL_SUBDIR_SHARE "share/games/supertux2/")\r
-  SET(INSTALL_SUBDIR_DOC "share/doc/supertux2/")\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/supertux2.desktop DESTINATION "share/applications")\r
-\r
-  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.xpm DESTINATION "share/pixmaps/")\r
-\r
-ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-ENDIF(WIN32 AND NOT UNIX)\r
-\r
-INSTALL(TARGETS supertux2 DESTINATION ${INSTALL_SUBDIR_BIN})\r
-\r
-INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/INSTALL ${SUPERTUX_SOURCE_DIR}/README ${SUPERTUX_SOURCE_DIR}/COPYING ${SUPERTUX_SOURCE_DIR}/WHATSNEW.txt DESTINATION ${INSTALL_SUBDIR_DOC})\r
-\r
-INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/credits.txt DESTINATION ${INSTALL_SUBDIR_SHARE})\r
-INSTALL(DIRECTORY data/images DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/levels DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/music DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/scripts DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/speech DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/sounds DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-INSTALL(DIRECTORY data/locale DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)\r
-\r
-\r
-## CPack/Installation-specific stuff\r
-\r
-INCLUDE(InstallRequiredSystemLibraries)\r
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")\r
-SET(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")\r
-SET(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <supertux-devel@lists.lethargik.org>")\r
-SET(CPACK_DEBIAN_PACKAGE_NAME "supertux2")\r
-SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.5), libgcc1 (>= 1:4.1), libgl1-mesa-glx | libgl1, libogg0 (>= 1.1.3), libopenal0a, libphysfs-1.0-0, libsdl-image1.2 (>= 1.2.5), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.2), libvorbis0a (>= 1.1.2), libvorbisfile3 (>= 1.1.2), libcurl3 (>= 7.16)")\r
-SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")\r
-SET(CPACK_DEBIAN_PACKAGE_SECTION "games")\r
-SET(CPACK_RPM_PACKAGE_NAME "supertux2")\r
-SET(CPACK_RPM_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")\r
-SET(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")\r
-SET(CPACK_RPM_PACKAGE_GROUP "Amusements/Games/Action/Arcade")\r
-IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-  # The OS X PackageMaker doesn't seem to like files with no extension\r
-ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${SUPERTUX_SOURCE_DIR}/README")\r
-  SET(CPACK_RESOURCE_FILE_LICENSE "${SUPERTUX_SOURCE_DIR}/COPYING")\r
-ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")\r
-SET(CPACK_PACKAGE_VERSION_MAJOR "0")\r
-SET(CPACK_PACKAGE_VERSION_MINOR "3")\r
-SET(CPACK_PACKAGE_VERSION_PATCH "2-SVN")\r
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")\r
-SET(CPACK_PACKAGE_EXECUTABLES "..\\\\supertux2" "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")\r
-IF(WIN32 AND NOT UNIX)\r
-  SET(CPACK_NSIS_INSTALLED_ICON_NAME "..\\\\supertux2")\r
-  SET(CPACK_NSIS_DISPLAY_NAME "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")\r
-ELSE(WIN32 AND NOT UNIX)\r
-ENDIF(WIN32 AND NOT UNIX)\r
-INCLUDE(CPack)\r
-\r
+#
+# SuperTux - root build script
+# Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+
+#
+# INSTRUCTIONS:
+# -------------
+#
+# Create a directory build/ and change to it. Run
+#
+#   cmake ..
+#
+# This creates a set of Makefiles to build the project. Run
+#
+#   make
+#
+
+
+## Project name to use as command prefix
+
+PROJECT(SUPERTUX)
+
+
+### CMake configuration
+
+# allow building with old CMake. Use some bundled modules as a fallback
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SUPERTUX_SOURCE_DIR}/mk/cmake)
+
+# move some config clutter to the advanced section
+MARK_AS_ADVANCED(
+       CMAKE_BACKWARDS_COMPATIBILITY
+       CMAKE_BUILD_TYPE
+       CMAKE_INSTALL_PREFIX
+       EXECUTABLE_OUTPUT_PATH
+       LIBRARY_OUTPUT_PATH
+       CMAKE_OSX_ARCHITECTURES
+       CMAKE_OSX_SYSROOT
+)
+
+## For autopackage
+MARK_AS_ADVANCED(
+       ENABLE_BINRELOC
+       APPDATADIR
+)
+OPTION(ENABLE_BINRELOC "Enable autopackage's BINRELOC features" OFF)
+SET(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/games/supertux2")
+
+## Check endianess
+
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
+
+## Add lots of dependencies to compiler switches
+
+FIND_PACKAGE(SDL REQUIRED)
+MARK_AS_ADVANCED(
+       SDLMAIN_LIBRARY
+       SDL_INCLUDE_DIR
+       SDL_LIBRARY
+)
+INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
+
+FIND_PACKAGE(SDL_image REQUIRED)
+MARK_AS_ADVANCED(
+       SDLIMAGE_INCLUDE_DIR
+       SDLIMAGE_LIBRARY
+)
+INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
+
+OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
+IF(ENABLE_OPENGL)
+  FIND_PACKAGE(OpenGL)
+  IF(${OPENGL_FOUND} STREQUAL "YES")
+    INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+    SET(HAVE_OPENGL TRUE)
+  ENDIF(${OPENGL_FOUND} STREQUAL "YES")
+ENDIF(ENABLE_OPENGL)
+
+FIND_PACKAGE(OpenAL REQUIRED)
+MARK_AS_ADVANCED(
+       OPENAL_INCLUDE_DIR
+       OPENAL_LIBRARY
+)
+INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
+
+FIND_PACKAGE(OggVorbis REQUIRED)
+MARK_AS_ADVANCED(
+       OGG_LIBRARY
+       VORBISENC_LIBRARY
+       VORBISFILE_LIBRARY
+       VORBIS_INCLUDE_DIR
+       VORBIS_LIBRARY
+)
+INCLUDE_DIRECTORIES(${OGGVORBIS_INCLUDE_DIR})
+
+FIND_PACKAGE(PhysFS REQUIRED)
+MARK_AS_ADVANCED(
+       PHYSFS_INCLUDE_DIR
+       PHYSFS_LIBRARY
+)
+INCLUDE_DIRECTORIES(${PHYSFS_INCLUDE_DIR})
+
+FIND_PACKAGE(CURL)
+IF(CURL_FOUND)
+  INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
+  SET(HAVE_LIBCURL TRUE)
+ENDIF(CURL_FOUND)
+
+#FIND_PACKAGE(ICONV REQUIRED)
+#INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
+#LINK_LIBRARIES(${ICONV_LIBRARY})
+
+## Find revision of WC
+FIND_PACKAGE(Subversion)
+IF(Subversion_FOUND)
+  Subversion_WC_INFO(${SUPERTUX_SOURCE_DIR} SUPERTUX)
+  SET(REVISION " r${SUPERTUX_WC_REVISION}")
+ENDIF(Subversion_FOUND)
+
+## Check platform-dependent build options
+
+INCLUDE(ConfigureChecks)
+
+## Create config.h
+
+configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
+include_directories (${CMAKE_BINARY_DIR}/)
+
+## Also execute instructions in src/squirrel/CMakeLists.txt
+
+ADD_SUBDIRECTORY(src/squirrel)
+
+## Add squirrel lib dir to search path
+
+LINK_DIRECTORIES(src/squirrel)
+
+## Some additional include paths
+
+include_directories (${SUPERTUX_SOURCE_DIR}/src/)
+include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/include/)
+
+## Build list of sources for supertux binary
+
+FILE(GLOB SUPERTUX_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/*.cpp src/*/*.cpp src/obstack/*.c)
+
+## Precompile "a few" headers in GCC
+OPTION(PRECOMPILE_HEADERS "Precompile headers (experimental)" OFF)
+IF(PRECOMPILE_HEADERS)
+  FILE(GLOB PRECOMPILED_HEADERS RELATIVE ${SUPERTUX_SOURCE_DIR} src/badguy/badguy.hpp
+           src/scripting/wrapper.hpp src/video/*.hpp src/math/*.hpp)
+  FILE(WRITE ${SUPERTUX_BINARY_DIR}/precompile.hh "// Precompiled headers\n")
+  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#ifndef __SUPERTUX_PRECOMPILED_HEADER\n")
+  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#define __SUPERTUX_PRECOMPILED_HEADER\n")
+  FOREACH(PRECOMPILED_HEADER ${PRECOMPILED_HEADERS})
+    FILE(RELATIVE_PATH PRECOMPILED_HEADER ${SUPERTUX_SOURCE_DIR}/src "${SUPERTUX_SOURCE_DIR}/${PRECOMPILED_HEADER}")
+    FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#include \"${PRECOMPILED_HEADER}\"\n")
+  ENDFOREACH(PRECOMPILED_HEADER)
+  FILE(APPEND ${SUPERTUX_BINARY_DIR}/precompile.hh "#endif /*__SUPERTUX_PRECOMPILED_HEADER*/\n")
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${SUPERTUX_BINARY_DIR}/precompile.hh.gch
+    COMMAND ${CMAKE_CXX_COMPILER} -x "c++-header" $(CXX_FLAGS) ${SUPERTUX_BINARY_DIR}/precompile.hh
+    DEPENDS ${PRECOMPILED_HEADERS}
+    COMMENT "Building precompiled header..."
+  )
+  ## Make certain it is built
+  SET(SUPERTUX_SOURCES ${SUPERTUX_BINARY_DIR}/precompile.hh.gch ${SUPERTUX_SOURCES})
+  SET(CMAKE_CXX_FLAGS "-include ${SUPERTUX_BINARY_DIR}/precompile.hh" ${CMAKE_CXX_FLAGS})
+ELSE(PRECOMPILE_HEADERS)
+  IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)
+    FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh)
+  ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh)
+  IF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
+    FILE(REMOVE ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
+  ENDIF(EXISTS ${SUPERTUX_BINARY_DIR}/precompile.hh.gch)
+ENDIF(PRECOMPILE_HEADERS)
+
+
+## Debug options
+
+OPTION(DEBUG "Build with debugging options" OFF)
+OPTION(PROFILE "Build with profiling information" OFF)
+OPTION(WERROR "Stops on first compiler warning in debug mode" ON)
+IF(CMAKE_COMPILER_IS_GNUCC)
+  ADD_DEFINITIONS(-Wall -W)
+  IF (DEBUG)
+    REMOVE_DEFINITIONS(-O2)
+    ADD_DEFINITIONS(-O0 -g)
+    IF(WERROR)
+      ADD_DEFINITIONS(-Werror)
+    ENDIF(WERROR)
+  ELSE (DEBUG)
+    ADD_DEFINITIONS(-O2)
+    REMOVE_DEFINITIONS(-O0 -g)
+  ENDIF (DEBUG)
+  IF (PROFILE)
+    ADD_DEFINITIONS(-pg)
+  ELSE (PROFILE)
+    REMOVE_DEFINITIONS(-pg)
+  ENDIF (PROFILE)
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+## Add in squirrel debug stuff
+
+OPTION(ENABLE_SQDBG "Build squirrel script interpreter with debugging options" OFF)
+IF(ENABLE_SQDBG)
+  include_directories (${SUPERTUX_SOURCE_DIR}/src/squirrel/)
+  FILE(GLOB SQDBG_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/squirrel/sqdbg/*.cpp)
+  SET(SUPERTUX_SOURCES ${SQDBG_SOURCES} ${SUPERTUX_SOURCES})
+ENDIF(ENABLE_SQDBG)
+
+## Build miniswig and generate miniswig wrapper
+
+OPTION(GENERATE_WRAPPER "Build miniswig and generate the wrapper" ${DEBUG})
+IF(GENERATE_WRAPPER)
+  ADD_SUBDIRECTORY(tools/miniswig)
+  FILE(GLOB GENERATE_WRAPPER_SOURCES RELATIVE ${SUPERTUX_SOURCE_DIR} src/scripting/*.?pp)
+  LIST(REMOVE_ITEM GENERATE_WRAPPER_SOURCES "src/scripting/wrapper.cpp" "src/scripting/wrapper.hpp")
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp
+    COMMAND cd ${SUPERTUX_SOURCE_DIR} && ${CMAKE_CXX_COMPILER}
+    ARGS -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o ${SUPERTUX_BINARY_DIR}/miniswig.tmp
+    COMMAND tools/miniswig/miniswig
+    ARGS --input miniswig.tmp --output-cpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace Scripting
+    DEPENDS ${GENERATE_WRAPPER_SOURCES} tools/miniswig/miniswig
+  )
+ENDIF(GENERATE_WRAPPER)
+
+IF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
+  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
+ENDIF(NOT EXISTS ${SUPERTUX_SOURCE_DIR}/src/scripting/wrapper.cpp)
+
+## If xgettext is available, generate messages.pot for sources
+
+OPTION(GENERATE_MESSAGESPOT "Generate messages.pot files" ${DEBUG})
+IF(GENERATE_MESSAGESPOT)
+  MARK_AS_ADVANCED(
+    XGETTEXT_EXECUTABLE
+  )
+  FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
+  IF(NOT XGETTEXT_EXECUTABLE)
+    MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot")
+  ELSE(NOT XGETTEXT_EXECUTABLE)
+    MESSAGE(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")
+
+    SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/data/locale/messages.pot)
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${MESSAGES_POT_FILE}
+      COMMAND ${XGETTEXT_EXECUTABLE}
+      ARGS --keyword=_ --language=C++ --output=${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES}
+      DEPENDS ${SUPERTUX_SOURCES}
+      WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
+      COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
+    )
+    LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
+
+    FILE(GLOB SUPERTUX_LEVEL_DIRS RELATIVE ${SUPERTUX_SOURCE_DIR} data/levels/*)
+    LIST(REMOVE_ITEM SUPERTUX_LEVEL_DIRS "data/levels/.svn")
+    FOREACH(SUPERTUX_LEVEL_DIR ${SUPERTUX_LEVEL_DIRS})
+      FILE(GLOB SUPERTUX_LEVELS RELATIVE ${SUPERTUX_SOURCE_DIR} ${SUPERTUX_LEVEL_DIR}/*.stl ${SUPERTUX_LEVEL_DIR}/*.stwm ${SUPERTUX_LEVEL_DIR}/*.txt)
+
+      ## Do not add target if SUPERTUX_LEVELS is empty. This is needed for cmake <=2.4
+      IF(SUPERTUX_LEVELS)
+      SET(MESSAGES_POT_FILE ${SUPERTUX_SOURCE_DIR}/${SUPERTUX_LEVEL_DIR}/messages.pot)
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${MESSAGES_POT_FILE}
+        COMMAND ${XGETTEXT_EXECUTABLE}
+        ARGS --keyword="_:1" --language=Lisp --sort-by-file --output=${MESSAGES_POT_FILE} ${SUPERTUX_LEVELS}
+        DEPENDS ${SUPERTUX_LEVELS}
+        WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
+        COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
+      )
+      LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
+      ENDIF(SUPERTUX_LEVELS)
+
+    ENDFOREACH(SUPERTUX_LEVEL_DIR)
+
+    ADD_CUSTOM_TARGET(
+      supertux2-messages ALL 
+      DEPENDS ${MESSAGES_POT_FILES}
+    )
+
+  ENDIF(NOT XGETTEXT_EXECUTABLE)
+ENDIF(GENERATE_MESSAGESPOT)
+
+## Some additional compiler switches
+IF(CMAKE_COMPILER_IS_GNUCC)
+  ADD_DEFINITIONS(-fno-strict-aliasing)
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  ADD_DEFINITIONS(-DMACOSX)
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
+
+## On Windows, add an icon
+
+IF(WIN32)
+  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
+  IF(MINGW)
+    ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o
+    COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons -i${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc -o ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
+    SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
+  ELSE(MINGW)
+    SET(SUPERTUX_EXE_SRCS ${SUPERTUX_EXE_SRCS} supertux.rc)
+  ENDIF(MINGW)
+ENDIF(WIN32)
+
+## Add binreloc.c if enabled
+IF(ENABLE_BINRELOC)
+  SET(SUPERTUX_SOURCES ${SUPERTUX_SOURCES} ${SUPERTUX_SOURCE_DIR}/src/binreloc/binreloc.c)
+ENDIF(ENABLE_BINRELOC)
+
+
+## Generate supertux executable in the right place
+
+SET(EXECUTABLE_OUTPUT_PATH ${SUPERTUX_SOURCE_DIR})
+
+## Add target for supertux binary
+
+ADD_EXECUTABLE(supertux2 ${SUPERTUX_SOURCES})
+
+## Link supertux binary with squirrel and other libraries
+
+TARGET_LINK_LIBRARIES(supertux2 squirrel)
+TARGET_LINK_LIBRARIES(supertux2 ${SDL_LIBRARY})
+TARGET_LINK_LIBRARIES(supertux2 ${SDLIMAGE_LIBRARY})
+TARGET_LINK_LIBRARIES(supertux2 ${OPENAL_LIBRARY})
+TARGET_LINK_LIBRARIES(supertux2 ${OGGVORBIS_LIBRARIES})
+TARGET_LINK_LIBRARIES(supertux2 ${PHYSFS_LIBRARY})
+IF(HAVE_OPENGL)
+    TARGET_LINK_LIBRARIES(supertux2 ${OPENGL_LIBRARY})
+ENDIF(HAVE_OPENGL)
+IF(HAVE_LIBCURL)
+  TARGET_LINK_LIBRARIES(supertux2 ${CURL_LIBRARY})
+ENDIF(HAVE_LIBCURL)
+
+## Install stuff
+
+IF(WIN32 AND NOT UNIX)
+
+  SET(INSTALL_SUBDIR_BIN ".")
+  SET(INSTALL_SUBDIR_SHARE "data/")
+  SET(INSTALL_SUBDIR_DOC ".")
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/SDL.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/SDL_image.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/iconv.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libogg-0.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libphysfs-1-0-0.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/OpenAl32.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/wrap_oal.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/libcurl-4.dll DESTINATION ${INSTALL_SUBDIR_BIN})
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")
+
+ELSE(WIN32 AND NOT UNIX)
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
+  SET(INSTALL_SUBDIR_BIN "SuperTux.app/Contents/MacOS/")
+  SET(INSTALL_SUBDIR_SHARE "SuperTux.app/Contents/Resources/data/")
+  SET(INSTALL_SUBDIR_DOC "SuperTux.app/Contents/Resources/")
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/tools/darwin/info.plist DESTINATION "SuperTux.app/Contents/")
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.icns DESTINATION "SuperTux.app/Contents/Resources/")
+
+ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
+  SET(INSTALL_SUBDIR_BIN "games/")
+  SET(INSTALL_SUBDIR_SHARE "share/games/supertux2/")
+  SET(INSTALL_SUBDIR_DOC "share/doc/supertux2/")
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/supertux2.desktop DESTINATION "share/applications")
+
+  INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.png ${SUPERTUX_SOURCE_DIR}/data/images/engine/icons/supertux.xpm DESTINATION "share/pixmaps/")
+
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ENDIF(WIN32 AND NOT UNIX)
+
+INSTALL(TARGETS supertux2 DESTINATION ${INSTALL_SUBDIR_BIN})
+
+INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/INSTALL ${SUPERTUX_SOURCE_DIR}/README ${SUPERTUX_SOURCE_DIR}/COPYING ${SUPERTUX_SOURCE_DIR}/WHATSNEW.txt DESTINATION ${INSTALL_SUBDIR_DOC})
+
+INSTALL(FILES ${SUPERTUX_SOURCE_DIR}/data/credits.txt DESTINATION ${INSTALL_SUBDIR_SHARE})
+INSTALL(DIRECTORY data/images DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/levels DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/music DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/scripts DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/speech DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/sounds DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+INSTALL(DIRECTORY data/locale DESTINATION ${INSTALL_SUBDIR_SHARE} PATTERN ".svn" EXCLUDE)
+
+
+## CPack/Installation-specific stuff
+
+INCLUDE(InstallRequiredSystemLibraries)
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")
+SET(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")
+SET(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <supertux-devel@lists.lethargik.org>")
+SET(CPACK_DEBIAN_PACKAGE_NAME "supertux2")
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.5), libgcc1 (>= 1:4.1), libgl1-mesa-glx | libgl1, libogg0 (>= 1.1.3), libopenal0a, libphysfs-1.0-0, libsdl-image1.2 (>= 1.2.5), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.2), libvorbis0a (>= 1.1.2), libvorbisfile3 (>= 1.1.2), libcurl3 (>= 7.16)")
+SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
+SET(CPACK_DEBIAN_PACKAGE_SECTION "games")
+SET(CPACK_RPM_PACKAGE_NAME "supertux2")
+SET(CPACK_RPM_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
+SET(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")
+SET(CPACK_RPM_PACKAGE_GROUP "Amusements/Games/Action/Arcade")
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  # The OS X PackageMaker doesn't seem to like files with no extension
+ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${SUPERTUX_SOURCE_DIR}/README")
+  SET(CPACK_RESOURCE_FILE_LICENSE "${SUPERTUX_SOURCE_DIR}/COPYING")
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+SET(CPACK_PACKAGE_VERSION_MAJOR "0")
+SET(CPACK_PACKAGE_VERSION_MINOR "3")
+SET(CPACK_PACKAGE_VERSION_PATCH "2-SVN")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+SET(CPACK_PACKAGE_EXECUTABLES "..\\\\supertux2" "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+IF(WIN32 AND NOT UNIX)
+  SET(CPACK_NSIS_INSTALLED_ICON_NAME "..\\\\supertux2")
+  SET(CPACK_NSIS_DISPLAY_NAME "SuperTux ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+ELSE(WIN32 AND NOT UNIX)
+ENDIF(WIN32 AND NOT UNIX)
+INCLUDE(CPack)
+