1
0
cuberite-2a/CMakeLists.txt

99 lines
3.1 KiB
CMake
Raw Normal View History

2014-09-06 11:30:04 -04:00
cmake_minimum_required (VERSION 2.8.7)
2013-12-10 13:41:43 -05:00
# Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html )
enable_language(CXX C)
2014-03-10 16:52:13 -04:00
# These env variables are used for configuring Travis CI builds.
# See https://github.com/mc-server/MCServer/pull/767
if(DEFINED ENV{TRAVIS_MCSERVER_BUILD_TYPE})
message("Setting build type to $ENV{TRAVIS_MCSERVER_BUILD_TYPE}")
set(CMAKE_BUILD_TYPE $ENV{TRAVIS_MCSERVER_BUILD_TYPE})
endif()
2014-03-10 16:52:13 -04:00
if(DEFINED ENV{TRAVIS_MCSERVER_FORCE32})
set(FORCE32 $ENV{TRAVIS_MCSERVER_FORCE32})
endif()
2014-05-10 08:03:36 -04:00
if(DEFINED ENV{TRAVIS_BUILD_WITH_COVERAGE})
set(BUILD_WITH_COVERAGE $ENV{TRAVIS_BUILD_WITH_COVERAGE})
endif()
2014-02-16 08:55:37 -05:00
# This has to be done before any flags have been set up.
if(${BUILD_TOOLS})
add_subdirectory(Tools/MCADefrag/)
add_subdirectory(Tools/ProtoProxy/)
endif()
if(${BUILD_UNSTABLE_TOOLS})
add_subdirectory(Tools/GeneratorPerformanceTest/)
endif()
include(SetFlags.cmake)
set_flags()
set_lib_flags()
enable_profile()
2013-12-27 06:01:45 -05:00
# Under Windows, we need Lua as DLL; on *nix we need it linked statically:
if (WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
endif()
2013-12-27 06:01:45 -05:00
# The Expat library is linked in statically, make the source files aware of that:
add_definitions(-DXML_STATIC)
# Self Test Mode enables extra checks at startup
if(${SELF_TEST})
add_definitions(-DSELF_TEST)
endif()
project (MCServer)
# Set options for SQLiteCpp, disable all their tests and lints:
set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "Run cpplint.py tool for Google C++ StyleGuide." FORCE)
set(SQLITECPP_RUN_CPPCHECK OFF CACHE BOOL "Run cppcheck C++ static analysis tool." FORCE)
set(SQLITECPP_RUN_DOXYGEN OFF CACHE BOOL "Run Doxygen C++ documentation tool." FORCE)
set(SQLITECPP_BUILD_EXAMPLES OFF CACHE BOOL "Build examples." FORCE)
set(SQLITECPP_BUILD_TESTS OFF CACHE BOOL "Build and run tests." FORCE)
set(SQLITECPP_INTERNAL_SQLITE OFF CACHE BOOL "Add the internal SQLite3 source to the project." FORCE)
# Include all the libraries:
2013-12-10 13:41:43 -05:00
add_subdirectory(lib/inifile/)
2013-12-10 16:39:20 -05:00
add_subdirectory(lib/jsoncpp/)
2013-12-10 18:26:55 -05:00
add_subdirectory(lib/zlib/)
2013-12-18 18:14:11 -05:00
add_subdirectory(lib/lua/)
2013-12-18 18:54:55 -05:00
add_subdirectory(lib/tolua++/)
2013-12-18 19:28:48 -05:00
add_subdirectory(lib/sqlite/)
add_subdirectory(lib/SQLiteCpp/)
2013-12-18 19:52:52 -05:00
add_subdirectory(lib/expat/)
add_subdirectory(lib/luaexpat/)
2013-12-10 16:39:20 -05:00
# Add proper include directories so that SQLiteCpp can find SQLite3:
get_property(SQLITECPP_INCLUDES DIRECTORY "lib/SQLiteCpp/" PROPERTY INCLUDE_DIRECTORIES)
set(SQLITECPP_INCLUDES "${SQLITECPP_INCLUDES}" "${CMAKE_CURRENT_SOURCE_DIR}/lib/sqlite/")
set_property(DIRECTORY lib/SQLiteCpp/ PROPERTY INCLUDE_DIRECTORIES "${SQLITECPP_INCLUDES}")
set_property(TARGET SQLiteCpp PROPERTY INCLUDE_DIRECTORIES "${SQLITECPP_INCLUDES}")
if (WIN32)
add_subdirectory(lib/luaproxy/)
endif()
# We use EXCLUDE_FROM_ALL so that only the explicit dependencies are used
# (PolarSSL also has test and example programs in their CMakeLists.txt, we don't want those)
include(lib/polarssl.cmake)
set_exe_flags()
2014-01-15 07:54:06 -05:00
add_subdirectory (src)
2013-12-10 13:41:43 -05:00
2014-04-27 15:25:03 -04:00
if(${SELF_TEST})
enable_testing()
add_subdirectory (tests)
endif()