From fc5fb03fec8720341ed87848af0004b23719ac95 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 21 Jul 2016 11:46:31 +0200 Subject: CMake: Fix system Lua usage for non-5.1 versions. (#3271) --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 272f2394d..aaaac1e1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,18 @@ +# This is the top-level CMakeLists.txt file for the Cuberite project +# +# Use CMake to generate the build files for your platform +# +# This script supports some configuration through CMake arguments (-Dparam=val syntax): +# BUILD_TOOLS=1 sets up additional executables to be built along with the server (ProtoProxy, GrownBiomeGenVisualiser, MCADefrag) +# BUILD_UNSTABLE_TOOLS=1 sets up yet more executables to be built, these can be broken and generally are obsolete (GeneratorPerformanceTest) +# CROSSCOMPILE=1 marks the build as a crosscompile (doesn't include optimizations for current platform) +# DISABLE_SYSTEM_LUA=1 disables the use of system Lua interpreter; the tolua executable will be built and used instead. Incompatible with cross-compiling +# SELF_TEST=1 enables testing code to be built + + + + + cmake_minimum_required (VERSION 2.8.7) if (POLICY CMP0054) @@ -96,15 +111,24 @@ endif() set(BUILD_TOOLS OFF CACHE BOOL "") set(SELF_TEST OFF CACHE BOOL "") -# Check whether Lua 5.1 is installed locally: -include(CheckLua.cmake) -if(HAS_LUA_INTERPRETER AND ("${LUA_INTERPRETER_VERSION}" STREQUAL "5.1")) - message(STATUS "Lua 5.1 has been found in your system and will be used for the build.") +# Check whether Lua 5.1 can be used: +if (NOT(DISABLE_SYSTEM_LUA)) + include(CheckLua.cmake) + if(HAS_LUA_INTERPRETER AND ("${LUA_INTERPRETER_VERSION}" STREQUAL "5.1")) + message(STATUS "Lua 5.1 has been found in your system and will be used for the build.") + set(USE_SYSTEM_LUA 1) + else() + if (CROSSCOMPILE) + message(FATAL "To crosscompile, you need to have Lua 5.1 installed in your system and available in PATH.") + endif() + message(STATUS "Lua 5.1 has NOT been found in your system, the build will use its own Lua implementation.") + unset(USE_SYSTEM_LUA) + endif() else() if (CROSSCOMPILE) - message(FATAL "To crosscompile, you need to have Lua 5.1 installed in your system and available in PATH.") + message(FATAL "CMake parameter mismatch: CROSSCOMPILE is mutually exclusive with DISABLE_SYSTEM_LUA") endif() - message(STATUS "Lua 5.1 has NOT been found in your system, the build will use its own Lua implementation.") + message(STATUS "System Lua is disabled via CMake command-line parameters. The build will use its own Lua implementation.") endif() -- cgit v1.2.3