cmake_minimum_required(VERSION 2.6) if (WIN32) FILE(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH ) FILE(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH ) endif(WIN32) project (eressea-server C) enable_testing() INCLUDE (CheckIncludeFiles) INCLUDE (CheckSymbolExists) CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H) CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H) CHECK_INCLUDE_FILES (io.h HAVE_IO_H) CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) IF (HAVE_IO_H) CHECK_SYMBOL_EXISTS (_access "io.h" HAVE__ACCESS) ENDIF (HAVE_IO_H) IF (HAVE_WINDOWS_H) CHECK_SYMBOL_EXISTS (_sleep "windows.h" HAVE__SLEEP) ENDIF(HAVE_WINDOWS_H) IF(HAVE_STDBOOL_H) CHECK_SYMBOL_EXISTS (_Bool "stdbool.h" HAVE__BOOL) ENDIF(HAVE_STDBOOL_H) IF(HAVE_UNISTD_H) CHECK_SYMBOL_EXISTS (sleep "unistd.h" HAVE_SLEEP) CHECK_SYMBOL_EXISTS (usleep "unistd.h" HAVE_USLEEP) CHECK_SYMBOL_EXISTS (access "unistd.h" HAVE_ACCESS) ENDIF(HAVE_UNISTD_H) CHECK_SYMBOL_EXISTS (strcasecmp "string.h" HAVE_STRCASECMP) CHECK_SYMBOL_EXISTS (strncasecmp "string.h" HAVE_STRNCASECMP) CHECK_SYMBOL_EXISTS (_strlwr "string.h" HAVE__STRLWR) CHECK_SYMBOL_EXISTS (_strcmpl "string.h" HAVE__STRCMPL) CHECK_SYMBOL_EXISTS (_strdup "string.h" HAVE__STRDUP) CHECK_SYMBOL_EXISTS (_stricmp "string.h" HAVE__STRICMP) CHECK_SYMBOL_EXISTS (_memicmp "string.h" HAVE__MEMICMP) CHECK_SYMBOL_EXISTS (strcmpl "string.h" HAVE_STRCMPL) CHECK_SYMBOL_EXISTS (strdup "string.h" HAVE_STRDUP) CHECK_SYMBOL_EXISTS (stricmp "string.h" HAVE_STRICMP) CHECK_SYMBOL_EXISTS (memicmp "string.h" HAVE_MEMICMP) CHECK_SYMBOL_EXISTS (strlwr "string.h" HAVE_STRLWR) CHECK_SYMBOL_EXISTS (snprintf "stdio.h" HAVE_SNPRINTF) CHECK_SYMBOL_EXISTS (_snprintf "stdio.h" HAVE__SNPRINTF) CHECK_SYMBOL_EXISTS (mkdir "sys/stat.h" HAVE_SYS_STAT_MKDIR) CHECK_SYMBOL_EXISTS (mkdir "direct.h" HAVE_DIRECT_MKDIR) CHECK_SYMBOL_EXISTS (_mkdir "direct.h" HAVE_DIRECT__MKDIR) CONFIGURE_FILE ( ${CMAKE_CURRENT_SOURCE_DIR}/autoconf.h.in ${CMAKE_BINARY_DIR}/include/autoconf.h) INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF") IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") elseif(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") ELSE(CMAKE_COMPILER_IS_GNUCC) MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}") ENDIF(CMAKE_COMPILER_IS_GNUCC) find_package (LibXml2) find_package (SQLite3) find_package (Curses) find_package (Lua REQUIRED) find_package (ToLua REQUIRED) add_subdirectory (cutest) add_subdirectory (crypto) add_subdirectory (cJSON) add_subdirectory (storage) add_subdirectory (iniparser) add_subdirectory (quicklist) add_subdirectory (critbit) add_subdirectory (src eressea) install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml") install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")