summaryrefslogblamecommitdiff
path: root/CMakeLists.txt
blob: 3254a7b3d7178e20d384095cc6e03ddaa1a1d13e (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                   
 
                 
 


                      

                                 
                                                        
 



                                                                

                                                        













































                                                                              
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)

project(MANASERV)

if(NOT VERSION)
  set(VERSION 0.1.0.0)
endif()

# where to look for cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)

option(WITH_SQLITE "Enable Sqlite support (used by default)" ON)
option(WITH_MYSQL "Enable MySQL support" OFF)
option(ENABLE_LUA "Enable Lua scripting support" ON)
option(ENABLE_EXTERNAL_ENET "Enable external ENet support" OFF)

# Exclude Sqlite support if the MySQL support was asked.
if(WITH_MYSQL)
  set(WITH_SQLITE OFF)
  set(WITH_POSTGRESQL OFF)
endif()

if(WITH_POSTGRESQL)
  message(STATUS "Warning: PostgreSQL support will likely not work...")
  set(WITH_SQLITE OFF)
  set(WITH_MYSQL OFF)
endif()

if(WITH_SQLITE)
  set(WITH_MYSQL OFF)
  set(WITH_POSTGRESQL OFF)
endif()

if(WIN32)
  set(PKG_DATADIR ".")
  set(PKG_BINDIR ".")
  set(LOCALEDIR ".")
  string(REPLACE "." " " _VERSION ${VERSION})
  separate_arguments(_VERSION)
  list(LENGTH _VERSION _LEN)
  if(NOT _LEN EQUAL 4)
    message(
      FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE.BUILD")
  endif()
  list(GET _VERSION 0 VER_MAJOR)
  list(GET _VERSION 1 VER_MINOR)
  list(GET _VERSION 2 VER_RELEASE)
  list(GET _VERSION 3 VER_BUILD)
  configure_file(src/common/winver.h.in src/common/winver.h)
else(WIN32)
  set(PKG_DATADIR ${CMAKE_INSTALL_PREFIX}/share/manaserv)
  set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
  set(PKG_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
endif(WIN32)

if(ENABLE_EXTERNAL_ENET)
  find_package(ENet)
else(ENABLE_EXTERNAL_ENET)
  add_subdirectory(libs/enet)
endif(ENABLE_EXTERNAL_ENET)

add_subdirectory(scripts)
add_subdirectory(src)