### CMake configuration
-# allow building with old CMake. Use some bundled modules as a fallback
+# allow building with old CMake. Set compatibility options. Use some bundled modules as a fallback
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+IF(COMMAND cmake_policy)
+ CMAKE_POLICY(SET CMP0003 NEW)
+ENDIF(COMMAND cmake_policy)
+
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SUPERTUX_SOURCE_DIR}/mk/cmake)
# move some config clutter to the advanced section
INCLUDE(ConfigureChecks)
-## Create config.h
+## Create config.h and version.h
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
+configure_file(version.h.cmake ${CMAKE_BINARY_DIR}/version.h )
include_directories (${CMAKE_BINARY_DIR}/)
## Also execute instructions in src/squirrel/CMakeLists.txt
## Debug options
-OPTION(WERROR "Stops on first compiler warning in debug mode" ON)
+OPTION(DEBUG "Build with debugging options" ON)
+OPTION(WERROR "Stop on first compiler warning" ON)
IF(CMAKE_COMPILER_IS_GNUCC)
- ADD_DEFINITIONS(-Wall -Wextra)
+ ADD_DEFINITIONS(-Wall -Wextra -W)
+ IF (DEBUG)
+ REMOVE_DEFINITIONS(-O2)
+ ADD_DEFINITIONS(-O0 -g)
+ ELSE (DEBUG)
+ ADD_DEFINITIONS(-O2)
+ REMOVE_DEFINITIONS(-O0 -g)
+ ENDIF (DEBUG)
SET(CMAKE_CXX_FLAGS_PROFILE "-pg")
SET(CMAKE_C_FLAGS_PROFILE "-pg")
SET(CMAKE_LD_FLAGS_PROFILE "-pg")
IF(WERROR)
ADD_DEFINITIONS(-Werror)
+ ELSE(WERROR)
+ REMOVE_DEFINITIONS(-Werror)
ENDIF(WERROR)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ADD_CUSTOM_COMMAND(
OUTPUT ${MESSAGES_POT_FILE}
COMMAND ${XGETTEXT_EXECUTABLE}
- ARGS --keyword="_:1" --language=Lisp --sort-by-file --output=${MESSAGES_POT_FILE} ${SUPERTUX_LEVELS}
+ ARGS --keyword="_:1" --language=Lisp --force-po --sort-by-file "--output=${MESSAGES_POT_FILE}" ${SUPERTUX_LEVELS}
DEPENDS ${SUPERTUX_LEVELS}
WORKING_DIRECTORY ${SUPERTUX_SOURCE_DIR}
COMMENT "Generating POT file ${MESSAGES_POT_FILE}"