summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-12 14:54:55 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-26 20:53:46 +0000
commiteafb9d28563cfc78250d0e0d6f12992e91156727 (patch)
tree974898928a9faba6b606ce8e44727c5580dd9ca7
parent6eca1b485dba7355d827745284ed2f0072f9e370 (diff)
downloadmana-eafb9d28563cfc78250d0e0d6f12992e91156727.tar.gz
mana-eafb9d28563cfc78250d0e0d6f12992e91156727.tar.bz2
mana-eafb9d28563cfc78250d0e0d6f12992e91156727.tar.xz
mana-eafb9d28563cfc78250d0e0d6f12992e91156727.zip
CMake: Added USE_SYSTEM_GUICHAN option
So that one can choose to build with the Guichan submodule also on other systems than macOS.
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt30
2 files changed, 16 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3365ff83..9bf55225 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ FIND_PACKAGE(Gettext)
OPTION(WITH_OPENGL "Enable OpenGL support" ON)
OPTION(ENABLE_NLS "Enable building of tranlations" ON)
OPTION(ENABLE_MANASERV "Enable Manaserv support" ON)
+OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
IF (WIN32)
SET(PKG_DATADIR ".")
@@ -52,7 +53,7 @@ ENDIF()
# On macOS we need to build Guichan ourselves since it is disabled in Homebrew
# This might also be a good idea for the Windows build
-if(APPLE)
+if(APPLE OR NOT USE_SYSTEM_GUICHAN)
# This policy makes sure that the below options are not ignored by the
# added Guichan CMakeLists.txt
SET(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 14547870..e57d5e3f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,32 +17,34 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
ENDIF()
+SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
+SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
+
IF (ENABLE_MANASERV)
INCLUDE_DIRECTORIES("../libs/enet/include")
LINK_DIRECTORIES("../libs/enet")
SET(INTERNAL_LIBRARIES enet)
+
+ SET(FLAGS "${FLAGS} -DMANASERV_SUPPORT=1")
+ MESSAGE(STATUS "Manaserv support enabled")
ENDIF()
-IF (APPLE)
- INCLUDE_DIRECTORIES("../libs/guichan/include")
+IF (APPLE OR NOT USE_SYSTEM_GUICHAN)
+ MESSAGE(STATUS "Using Guichan submodule")
+ SET(GUICHAN_INCLUDE_DIR "../libs/guichan/include")
+ SET(GUICHAN_LIBRARIES guichan)
LINK_DIRECTORIES("../libs/guichan")
- SET(INTERNAL_LIBRARIES ${INTERNAL_LIBRARIES} guichan)
+ELSE()
+ MESSAGE(STATUS "Using system Guichan")
+ FIND_PACKAGE(Guichan REQUIRED)
ENDIF()
-SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
-SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
-
IF (ENABLE_NLS)
SET(FLAGS "${FLAGS} -DENABLE_NLS=1")
MESSAGE(STATUS "i18n support enabled")
ENDIF()
-IF (ENABLE_MANASERV)
- SET(FLAGS "${FLAGS} -DMANASERV_SUPPORT=1")
- MESSAGE(STATUS "Manaserv support enabled")
-ENDIF()
-
IF (CMAKE_BUILD_TYPE)
STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR
@@ -62,10 +64,6 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL SunOS)
SET(EXTRA_LIBRARIES intl)
ENDIF()
-IF(NOT APPLE)
- FIND_PACKAGE(Guichan REQUIRED)
-ENDIF()
-
IF (WITH_OPENGL)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})