summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt279
-rw-r--r--data/CMakeLists.txt11
-rw-r--r--po/CMakeLists.txt164
-rw-r--r--src/CMakeLists.txt263
-rw-r--r--tools/dyecmd/CMakeLists.txt43
-rw-r--r--tools/dyecmd/src/CMakeLists.txt97
6 files changed, 427 insertions, 430 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11b553e7..d8e9f865 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,156 +1,167 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.27)
+cmake_minimum_required(VERSION 3.12...3.27)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
-IF (NOT VERSION)
- SET(VERSION 0.6.1)
-ELSE()
- STRING(REPLACE "." " " _VERSION ${VERSION})
- SEPARATE_ARGUMENTS(_VERSION)
- LIST(LENGTH _VERSION _LEN)
- IF(NOT _LEN EQUAL 4 AND NOT _LEN EQUAL 3)
- MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
- ENDIF()
-ENDIF()
-
-PROJECT(Mana
- VERSION ${VERSION}
- DESCRIPTION "Mana MMORPG Client"
- HOMEPAGE_URL "https://www.manasource.org")
+if(NOT VERSION)
+ set(VERSION 0.6.1)
+else()
+ string(REPLACE "." " " _VERSION ${VERSION})
+ separate_arguments(_VERSION)
+ list(LENGTH _VERSION _LEN)
+ if(NOT _LEN EQUAL 4 AND NOT _LEN EQUAL 3)
+ message(
+ FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
+ endif()
+endif()
+
+project(
+ Mana
+ VERSION ${VERSION}
+ DESCRIPTION "Mana MMORPG Client"
+ HOMEPAGE_URL "https://www.manasource.org")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# where to look for cmake modules
-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
include(GNUInstallDirs)
-FIND_PACKAGE(Gettext)
-
-OPTION(WITH_OPENGL "Enable OpenGL support" ON)
-OPTION(ENABLE_NLS "Enable building of translations" ON)
-OPTION(ENABLE_MANASERV "Enable Manaserv support" ON)
-OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
-
-IF (WIN32)
- SET(CMAKE_INSTALL_DATADIR ".")
- SET(CMAKE_INSTALL_LOCALEDIR "translations")
- SET(CMAKE_INSTALL_BINDIR ".")
-ELSEIF(APPLE)
- SET(CMAKE_INSTALL_DATAROOTDIR "Mana.app/Contents")
- SET(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}/Resources")
- SET(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATADIR}/Translations")
-ELSE()
- SET(CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana)
-ENDIF ()
+find_package(Gettext)
+
+option(WITH_OPENGL "Enable OpenGL support" ON)
+option(ENABLE_NLS "Enable building of translations" ON)
+option(ENABLE_MANASERV "Enable Manaserv support" ON)
+option(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
+
+if(WIN32)
+ set(CMAKE_INSTALL_DATADIR ".")
+ set(CMAKE_INSTALL_LOCALEDIR "translations")
+ set(CMAKE_INSTALL_BINDIR ".")
+elseif(APPLE)
+ set(CMAKE_INSTALL_DATAROOTDIR "Mana.app/Contents")
+ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}/Resources")
+ set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATADIR}/Translations")
+else()
+ set(CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana)
+endif()
-ADD_SUBDIRECTORY(data)
+add_subdirectory(data)
-IF (ENABLE_MANASERV)
- ADD_SUBDIRECTORY(libs/enet)
-ENDIF()
+if(ENABLE_MANASERV)
+ add_subdirectory(libs/enet)
+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 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)
- SET(ENABLE_ALLEGRO OFF)
- SET(ENABLE_IRRLICHT OFF)
- SET(ENABLE_SDL OFF)
- SET(ENABLE_OPENGL OFF)
- SET(BUILD_GUICHAN_SHARED OFF)
- ADD_SUBDIRECTORY(libs/guichan EXCLUDE_FROM_ALL)
+ # This policy makes sure that the below options are not ignored by the added
+ # Guichan CMakeLists.txt
+ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
+ set(ENABLE_ALLEGRO OFF)
+ set(ENABLE_IRRLICHT OFF)
+ set(ENABLE_SDL OFF)
+ set(ENABLE_OPENGL OFF)
+ set(BUILD_GUICHAN_SHARED OFF)
+ add_subdirectory(libs/guichan EXCLUDE_FROM_ALL)
endif()
# Set generic CPack properties here so they may be used in subdirectories
-SET(CPACK_PACKAGE_VENDOR "Mana Development Team")
-SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
-SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}") # by default it includes the version
-SET(CPACK_PACKAGE_EXECUTABLES "mana;Mana")
-SET(CPACK_VERBATIM_VARIABLES TRUE)
-
-ADD_SUBDIRECTORY(src)
-
-IF (GETTEXT_FOUND AND ENABLE_NLS)
- ADD_SUBDIRECTORY(po)
-ENDIF()
-
-If(UNIX AND NOT APPLE)
- INSTALL(FILES org.manasource.Mana.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
- INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
- INSTALL(FILES data/icons/mana.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png)
- INSTALL(FILES data/icons/mana.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg)
-ENDIF()
+set(CPACK_PACKAGE_VENDOR "Mana Development Team")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+# By default the install directory includes the version
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
+set(CPACK_PACKAGE_EXECUTABLES "mana;Mana")
+set(CPACK_VERBATIM_VARIABLES TRUE)
+
+add_subdirectory(src)
+
+if(GETTEXT_FOUND AND ENABLE_NLS)
+ add_subdirectory(po)
+endif()
+
+if(UNIX AND NOT APPLE)
+ install(FILES org.manasource.Mana.desktop
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
+ install(FILES org.manasource.Mana.metainfo.xml
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
+ install(
+ FILES data/icons/mana.png
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps
+ RENAME org.manasource.Mana.png)
+ install(
+ FILES data/icons/mana.svg
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps
+ RENAME org.manasource.Mana.svg)
+endif()
# Windows NSIS installer
-IF(WIN32)
- SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/icons/mana.ico")
- SET(CPACK_NSIS_INSTALLED_ICON_NAME "mana.exe")
- SET(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_SOURCE_DIR}\\packaging\\windows\\setup_welcome.bmp")
- SET(CPACK_NSIS_URL_INFO_ABOUT ${PROJECT_HOMEPAGE_URL})
- SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
- SET(CPACK_NSIS_MUI_FINISHPAGE_RUN "mana.exe")
- SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR})
- SET(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
-
- install(FILES
- $ENV{MINGW_PREFIX}/bin/libgcc_s_seh-1.dll
- $ENV{MINGW_PREFIX}/bin/libwinpthread-1.dll
- $ENV{MINGW_PREFIX}/bin/libstdc++-6.dll
- $ENV{MINGW_PREFIX}/bin/libcurl-4.dll
- $ENV{MINGW_PREFIX}/bin/libintl-8.dll
- $ENV{MINGW_PREFIX}/bin/libphysfs.dll
- $ENV{MINGW_PREFIX}/bin/libpng16-16.dll
- $ENV{MINGW_PREFIX}/bin/SDL2.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_image.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_mixer.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_net.dll
- $ENV{MINGW_PREFIX}/bin/SDL2_ttf.dll
- $ENV{MINGW_PREFIX}/bin/libxml2-2.dll
- $ENV{MINGW_PREFIX}/bin/zlib1.dll
- $ENV{MINGW_PREFIX}/bin/libiconv-2.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlidec.dll
- $ENV{MINGW_PREFIX}/bin/libidn2-0.dll
- $ENV{MINGW_PREFIX}/bin/libpsl-5.dll
- $ENV{MINGW_PREFIX}/bin/libssh2-1.dll
- $ENV{MINGW_PREFIX}/bin/libzstd.dll
- $ENV{MINGW_PREFIX}/bin/libavif-16.dll
- $ENV{MINGW_PREFIX}/bin/libjxl.dll
- $ENV{MINGW_PREFIX}/bin/libjpeg-8.dll
- $ENV{MINGW_PREFIX}/bin/libtiff-6.dll
- $ENV{MINGW_PREFIX}/bin/libwebp-7.dll
- $ENV{MINGW_PREFIX}/bin/libwebpdemux-2.dll
- $ENV{MINGW_PREFIX}/bin/libmpg123-0.dll
- $ENV{MINGW_PREFIX}/bin/libopusfile-0.dll
- $ENV{MINGW_PREFIX}/bin/libfreetype-6.dll
- $ENV{MINGW_PREFIX}/bin/libharfbuzz-0.dll
- $ENV{MINGW_PREFIX}/bin/liblzma-5.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlicommon.dll
- $ENV{MINGW_PREFIX}/bin/libunistring-5.dll
- $ENV{MINGW_PREFIX}/bin/libaom.dll
- $ENV{MINGW_PREFIX}/bin/libdav1d-7.dll
- $ENV{MINGW_PREFIX}/bin/libsharpyuv-0.dll
- $ENV{MINGW_PREFIX}/bin/libSvtAv1Enc-2.dll
- $ENV{MINGW_PREFIX}/bin/libyuv.dll
- $ENV{MINGW_PREFIX}/bin/libbrotlienc.dll
- $ENV{MINGW_PREFIX}/bin/libhwy.dll
- $ENV{MINGW_PREFIX}/bin/libjxl_cms.dll
- $ENV{MINGW_PREFIX}/bin/libdeflate.dll
- $ENV{MINGW_PREFIX}/bin/libjbig-0.dll
- $ENV{MINGW_PREFIX}/bin/libLerc.dll
- $ENV{MINGW_PREFIX}/bin/libopus-0.dll
- $ENV{MINGW_PREFIX}/bin/rav1e.dll
- $ENV{MINGW_PREFIX}/bin/libbz2-1.dll
- $ENV{MINGW_PREFIX}/bin/libglib-2.0-0.dll
- $ENV{MINGW_PREFIX}/bin/libogg-0.dll
- $ENV{MINGW_PREFIX}/bin/libgraphite2.dll
- $ENV{MINGW_PREFIX}/bin/liblcms2-2.dll
- $ENV{MINGW_PREFIX}/bin/libpcre2-8-0.dll
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
-ENDIF()
-INCLUDE(CPack)
+if(WIN32)
+ set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/data/icons/mana.ico")
+ set(CPACK_NSIS_INSTALLED_ICON_NAME "mana.exe")
+ set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP
+ "${CMAKE_SOURCE_DIR}\\packaging\\windows\\setup_welcome.bmp")
+ set(CPACK_NSIS_URL_INFO_ABOUT ${PROJECT_HOMEPAGE_URL})
+ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
+ set(CPACK_NSIS_MUI_FINISHPAGE_RUN "mana.exe")
+ set(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR})
+ set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
+
+ install(
+ FILES $ENV{MINGW_PREFIX}/bin/libgcc_s_seh-1.dll
+ $ENV{MINGW_PREFIX}/bin/libwinpthread-1.dll
+ $ENV{MINGW_PREFIX}/bin/libstdc++-6.dll
+ $ENV{MINGW_PREFIX}/bin/libcurl-4.dll
+ $ENV{MINGW_PREFIX}/bin/libintl-8.dll
+ $ENV{MINGW_PREFIX}/bin/libphysfs.dll
+ $ENV{MINGW_PREFIX}/bin/libpng16-16.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_image.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_mixer.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_net.dll
+ $ENV{MINGW_PREFIX}/bin/SDL2_ttf.dll
+ $ENV{MINGW_PREFIX}/bin/libxml2-2.dll
+ $ENV{MINGW_PREFIX}/bin/zlib1.dll
+ $ENV{MINGW_PREFIX}/bin/libiconv-2.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlidec.dll
+ $ENV{MINGW_PREFIX}/bin/libidn2-0.dll
+ $ENV{MINGW_PREFIX}/bin/libpsl-5.dll
+ $ENV{MINGW_PREFIX}/bin/libssh2-1.dll
+ $ENV{MINGW_PREFIX}/bin/libzstd.dll
+ $ENV{MINGW_PREFIX}/bin/libavif-16.dll
+ $ENV{MINGW_PREFIX}/bin/libjxl.dll
+ $ENV{MINGW_PREFIX}/bin/libjpeg-8.dll
+ $ENV{MINGW_PREFIX}/bin/libtiff-6.dll
+ $ENV{MINGW_PREFIX}/bin/libwebp-7.dll
+ $ENV{MINGW_PREFIX}/bin/libwebpdemux-2.dll
+ $ENV{MINGW_PREFIX}/bin/libmpg123-0.dll
+ $ENV{MINGW_PREFIX}/bin/libopusfile-0.dll
+ $ENV{MINGW_PREFIX}/bin/libfreetype-6.dll
+ $ENV{MINGW_PREFIX}/bin/libharfbuzz-0.dll
+ $ENV{MINGW_PREFIX}/bin/liblzma-5.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlicommon.dll
+ $ENV{MINGW_PREFIX}/bin/libunistring-5.dll
+ $ENV{MINGW_PREFIX}/bin/libaom.dll
+ $ENV{MINGW_PREFIX}/bin/libdav1d-7.dll
+ $ENV{MINGW_PREFIX}/bin/libsharpyuv-0.dll
+ $ENV{MINGW_PREFIX}/bin/libSvtAv1Enc-2.dll
+ $ENV{MINGW_PREFIX}/bin/libyuv.dll
+ $ENV{MINGW_PREFIX}/bin/libbrotlienc.dll
+ $ENV{MINGW_PREFIX}/bin/libhwy.dll
+ $ENV{MINGW_PREFIX}/bin/libjxl_cms.dll
+ $ENV{MINGW_PREFIX}/bin/libdeflate.dll
+ $ENV{MINGW_PREFIX}/bin/libjbig-0.dll
+ $ENV{MINGW_PREFIX}/bin/libLerc.dll
+ $ENV{MINGW_PREFIX}/bin/libopus-0.dll
+ $ENV{MINGW_PREFIX}/bin/rav1e.dll
+ $ENV{MINGW_PREFIX}/bin/libbz2-1.dll
+ $ENV{MINGW_PREFIX}/bin/libglib-2.0-0.dll
+ $ENV{MINGW_PREFIX}/bin/libogg-0.dll
+ $ENV{MINGW_PREFIX}/bin/libgraphite2.dll
+ $ENV{MINGW_PREFIX}/bin/liblcms2-2.dll
+ $ENV{MINGW_PREFIX}/bin/libpcre2-8-0.dll
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()
+include(CPack)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 198787dc..2ec887cc 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -1,9 +1,2 @@
-INSTALL(DIRECTORY
- fonts
- graphics
- help
- icons
- music
- sfx
- DESTINATION ${CMAKE_INSTALL_DATADIR}/data
-)
+install(DIRECTORY fonts graphics help icons music sfx
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/data)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index f2ae4b93..e0cfc325 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,82 +1,82 @@
-FIND_PACKAGE(Gettext REQUIRED)
-
-# based on the CMake 2.6.3 GETTEXT_CREATE_TRANSLATIONS
-# we need our own version because the upstream one contains
-# a call to msgmerge (updating po files) which can't be
-# disabled
-MACRO(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
- # make it a real variable, so we can modify it here
- SET(_firstPoFile "${_firstPoFileArg}")
-
- SET(_gmoFiles)
- GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
- GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
-
- SET(_addToAll)
- IF(${_firstPoFile} STREQUAL "ALL")
- SET(_addToAll "ALL")
- SET(_firstPoFile)
- ENDIF(${_firstPoFile} STREQUAL "ALL")
-
- FOREACH (_currentPoFile ${_firstPoFile} ${ARGN})
- GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
- GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
- GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE)
- SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
- DEPENDS ${_absPotFile} ${_absFile}
- )
-
- INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
- SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
-
- ENDFOREACH (_currentPoFile)
-
- ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
-ENDMACRO()
-
-MACRO(MANA_GETTEXT_UPDATE_PO _potFile _languages)
- GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
-
- ADD_CUSTOM_TARGET(
- update-pot
- COMMAND xgettext --files-from=translatable-files --directory=. --output=${_potFile} -d mana --keyword=_ --keyword=N_
- )
-
- ADD_CUSTOM_TARGET(
- update-translatable-files
- COMMAND grep '_\(' -Irl ../src | sort > translatable-files
- )
-
- FOREACH(_lang ${_languages})
- GET_FILENAME_COMPONENT(_absFile "${_lang}.po" ABSOLUTE)
- SET(_currentPoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po)
- ADD_CUSTOM_TARGET(
- "update-translation-${_lang}"
- COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
- )
- ADD_DEPENDENCIES("update-translation-${_lang}" update-pot)
- ADD_DEPENDENCIES(update-po "update-translation-${_lang}")
- ADD_DEPENDENCIES(update-pot update-translatable-files)
- ENDFOREACH()
-ENDMACRO()
-
-
-SET(languages)
-SET(POFILES)
-FILE(STRINGS LINGUAS _languages)
-FOREACH(_lang ${_languages})
- STRING(REGEX REPLACE "#.*" "" _lang "${_lang}")
- IF(NOT ${_lang} STREQUAL "")
- SET(languages ${languages} ${_lang})
- SET(POFILES ${POFILES} "${_lang}.po")
- ENDIF()
-ENDFOREACH()
-
-ADD_CUSTOM_TARGET(update-po)
-
-MANA_GETTEXT_CREATE_TRANSLATIONS(mana.pot ALL ${POFILES})
-MANA_GETTEXT_UPDATE_PO(mana.pot "${languages}")
+find_package(Gettext REQUIRED)
+
+# based on the CMake 2.6.3 GETTEXT_CREATE_TRANSLATIONS we need our own version
+# because the upstream one contains a call to msgmerge (updating po files) which
+# can't be disabled
+macro(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
+ # make it a real variable, so we can modify it here
+ set(_firstPoFile "${_firstPoFileArg}")
+
+ set(_gmoFiles)
+ get_filename_component(_potBasename ${_potFile} NAME_WE)
+ get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
+
+ set(_addToAll)
+ if(${_firstPoFile} STREQUAL "ALL")
+ set(_addToAll "ALL")
+ set(_firstPoFile)
+ endif(${_firstPoFile} STREQUAL "ALL")
+
+ foreach(_currentPoFile ${_firstPoFile} ${ARGN})
+ get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
+ get_filename_component(_abs_PATH ${_absFile} PATH)
+ get_filename_component(_lang ${_absFile} NAME_WE)
+ set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ add_custom_command(
+ OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+ DEPENDS ${_absPotFile} ${_absFile})
+
+ install(
+ FILES ${_gmoFile}
+ DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES
+ RENAME ${_potBasename}.mo)
+ set(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+ endforeach(_currentPoFile)
+
+ add_custom_target(
+ translations
+ ${_addToAll}
+ DEPENDS ${_gmoFiles})
+endmacro()
+
+macro(MANA_GETTEXT_UPDATE_PO _potFile _languages)
+ get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
+
+ add_custom_target(
+ update-pot COMMAND xgettext --files-from=translatable-files --directory=.
+ --output=${_potFile} -d mana --keyword=_ --keyword=N_)
+
+ add_custom_target(update-translatable-files COMMAND grep '_\(' -Irl ../src |
+ sort > translatable-files)
+
+ foreach(_lang ${_languages})
+ get_filename_component(_absFile "${_lang}.po" ABSOLUTE)
+ set(_currentPoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po)
+ add_custom_target(
+ "update-translation-${_lang}"
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s
+ ${_absFile} ${_absPotFile})
+ add_dependencies("update-translation-${_lang}" update-pot)
+ add_dependencies(update-po "update-translation-${_lang}")
+ add_dependencies(update-pot update-translatable-files)
+ endforeach()
+endmacro()
+
+set(languages)
+set(POFILES)
+file(STRINGS LINGUAS _languages)
+foreach(_lang ${_languages})
+ string(REGEX REPLACE "#.*" "" _lang "${_lang}")
+ if(NOT ${_lang} STREQUAL "")
+ set(languages ${languages} ${_lang})
+ set(POFILES ${POFILES} "${_lang}.po")
+ endif()
+endforeach()
+
+add_custom_target(update-po)
+
+mana_gettext_create_translations(mana.pot ALL ${POFILES})
+mana_gettext_update_po(mana.pot "${languages}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1973c49a..84ea1ad7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,93 +1,96 @@
include(FindPkgConfig)
-pkg_check_modules(SDL2 REQUIRED sdl2>=2.0.5 SDL2_image SDL2_mixer SDL2_net SDL2_ttf)
-FIND_PACKAGE(PhysFS REQUIRED)
-FIND_PACKAGE(CURL REQUIRED)
-FIND_PACKAGE(LibXml2 REQUIRED)
-FIND_PACKAGE(PNG REQUIRED)
-FIND_PACKAGE(Gettext REQUIRED)
+pkg_check_modules(SDL2 REQUIRED
+ sdl2>=2.0.5
+ SDL2_image
+ SDL2_mixer
+ SDL2_net
+ SDL2_ttf)
+find_package(PhysFS REQUIRED)
+find_package(CURL REQUIRED)
+find_package(LibXml2 REQUIRED)
+find_package(PNG REQUIRED)
+find_package(Gettext REQUIRED)
-IF (CMAKE_COMPILER_IS_GNUCXX)
- # Help getting compilation warnings
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
- IF (WIN32)
- # This includes enough debug information to get something useful
- # from Dr. Mingw while keeping binary size down. Almost useless
- # with gdb, though.
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
- ENDIF()
-ENDIF()
+if(CMAKE_COMPILER_IS_GNUCXX)
+ # Help getting compilation warnings
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+ if(WIN32)
+ # This includes enough debug information to get something useful from Dr.
+ # Mingw while keeping binary size down. Almost useless with gdb, though.
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
+ endif()
+endif()
-SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
+set(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-IF (WIN32)
- SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_DATADIR}/\\\"")
- SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_LOCALEDIR}/\\\"")
-ELSEIF(NOT APPLE)
- SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_FULL_DATADIR}/\\\"")
- SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_FULL_LOCALEDIR}/\\\"")
-ENDIF()
+if(WIN32)
+ set(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_DATADIR}/\\\"")
+ set(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_LOCALEDIR}/\\\"")
+elseif(NOT APPLE)
+ set(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_FULL_DATADIR}/\\\"")
+ set(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_FULL_LOCALEDIR}/\\\"")
+endif()
-IF (ENABLE_MANASERV)
- INCLUDE_DIRECTORIES("../libs/enet/include")
- LINK_DIRECTORIES("../libs/enet")
- SET(INTERNAL_LIBRARIES enet)
+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()
+ set(FLAGS "${FLAGS} -DMANASERV_SUPPORT=1")
+ message(STATUS "Manaserv support enabled")
+endif()
-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")
-ELSE()
- MESSAGE(STATUS "Using system Guichan")
- FIND_PACKAGE(Guichan REQUIRED)
-ENDIF()
+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")
+else()
+ message(STATUS "Using system Guichan")
+ find_package(Guichan REQUIRED)
+endif()
-IF (ENABLE_NLS)
- SET(FLAGS "${FLAGS} -DENABLE_NLS=1")
- MESSAGE(STATUS "i18n support enabled")
-ENDIF()
+if(ENABLE_NLS)
+ set(FLAGS "${FLAGS} -DENABLE_NLS=1")
+ message(STATUS "i18n support enabled")
+endif()
-IF (CMAKE_BUILD_TYPE)
- STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
- IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR
- CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo)
- SET(FLAGS "${FLAGS} -DDEBUG")
- MESSAGE(STATUS "Set Debug build type")
- ENDIF()
-ENDIF()
+if(CMAKE_BUILD_TYPE)
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR CMAKE_BUILD_TYPE_TOLOWER MATCHES
+ relwithdebinfo)
+ set(FLAGS "${FLAGS} -DDEBUG")
+ message(STATUS "Set Debug build type")
+ endif()
+endif()
-IF (WIN32)
- SET(EXTRA_LIBRARIES ws2_32 winmm)
- FIND_PACKAGE(LibIntl REQUIRED)
-ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR BEOS)
- FIND_PACKAGE(LibIntl REQUIRED)
-ELSEIF (CMAKE_SYSTEM_NAME STREQUAL SunOS)
- # explicit linking to libintl is required on Solaris
- SET(EXTRA_LIBRARIES intl)
-ENDIF()
+if(WIN32)
+ set(EXTRA_LIBRARIES ws2_32 winmm)
+ find_package(LibIntl REQUIRED)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR BEOS)
+ find_package(LibIntl REQUIRED)
+elseif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
+ # explicit linking to libintl is required on Solaris
+ set(EXTRA_LIBRARIES intl)
+endif()
-IF (WITH_OPENGL)
- FIND_PACKAGE(OpenGL REQUIRED)
- INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
- SET(FLAGS "${FLAGS} -DUSE_OPENGL")
- MESSAGE(STATUS "OpenGL support enabled")
-ENDIF (WITH_OPENGL)
+if(WITH_OPENGL)
+ find_package(OpenGL REQUIRED)
+ include_directories(${OPENGL_INCLUDE_DIR})
+ set(FLAGS "${FLAGS} -DUSE_OPENGL")
+ message(STATUS "OpenGL support enabled")
+endif(WITH_OPENGL)
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${SDL2_INCLUDE_DIRS}
- ${PNG_INCLUDE_DIR}
- ${PHYSFS_INCLUDE_DIR}
- ${CURL_INCLUDE_DIR}
- ${LIBXML2_INCLUDE_DIR}
- ${GUICHAN_INCLUDE_DIR}
- )
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${SDL2_INCLUDE_DIRS}
+ ${PNG_INCLUDE_DIR}
+ ${PHYSFS_INCLUDE_DIR}
+ ${CURL_INCLUDE_DIR}
+ ${LIBXML2_INCLUDE_DIR}
+ ${GUICHAN_INCLUDE_DIR})
-SET(SRCS
+set(SRCS
gui/widgets/avatarlistbox.cpp
gui/widgets/avatarlistbox.h
gui/widgets/browserbox.cpp
@@ -510,10 +513,9 @@ SET(SRCS
vector.cpp
vector.h
video.cpp
- video.h
- )
+ video.h)
-SET(SRCS_TMWA
+set(SRCS_TMWA
net/tmwa/gui/guildtab.cpp
net/tmwa/gui/guildtab.h
net/tmwa/gui/partytab.cpp
@@ -559,10 +561,9 @@ SET(SRCS_TMWA
net/tmwa/specialhandler.h
net/tmwa/token.h
net/tmwa/tradehandler.cpp
- net/tmwa/tradehandler.h
- )
+ net/tmwa/tradehandler.h)
-SET(SRCS_MANA
+set(SRCS_MANA
net/manaserv/adminhandler.cpp
net/manaserv/adminhandler.h
net/manaserv/beinghandler.cpp
@@ -610,65 +611,69 @@ SET(SRCS_MANA
net/manaserv/specialhandler.cpp
net/manaserv/specialhandler.h
net/manaserv/tradehandler.cpp
- net/manaserv/tradehandler.h
- )
+ net/manaserv/tradehandler.h)
-IF (WIN32)
- CONFIGURE_FILE(mana.rc.in mana.rc)
- SET(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/mana.rc)
-ENDIF (WIN32)
+if(WIN32)
+ configure_file(mana.rc.in mana.rc)
+ set(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/mana.rc)
+endif(WIN32)
set(APP_ICON_NAME "mana.icns")
set(APP_ICON_FILE "${CMAKE_SOURCE_DIR}/data/icons/${APP_ICON_NAME}")
-set_source_files_properties(${APP_ICON_FILE} PROPERTIES
- MACOSX_PACKAGE_LOCATION "Resources")
+set_source_files_properties(${APP_ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION
+ "Resources")
-IF (ENABLE_MANASERV)
- ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_MANA} ${SRCS_TMWA} ${APP_ICON_FILE})
-ELSE(ENABLE_MANASERV)
- ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_TMWA} ${APP_ICON_FILE})
-ENDIF(ENABLE_MANASERV)
+if(ENABLE_MANASERV)
+ add_executable(mana WIN32 ${SRCS} ${SRCS_MANA} ${SRCS_TMWA} ${APP_ICON_FILE})
+else(ENABLE_MANASERV)
+ add_executable(mana WIN32 ${SRCS} ${SRCS_TMWA} ${APP_ICON_FILE})
+endif(ENABLE_MANASERV)
-TARGET_LINK_LIBRARIES(mana PRIVATE
- ${INTERNAL_LIBRARIES}
- ${SDL2_LINK_LIBRARIES}
- ${PNG_LIBRARIES}
- ${PHYSFS_LIBRARY}
- ${CURL_LIBRARIES}
- ${LIBXML2_LIBRARIES}
- ${GUICHAN_LIBRARIES}
- ${OPENGL_LIBRARIES}
- ${LIBINTL_LIBRARIES}
- ${EXTRA_LIBRARIES})
+target_link_libraries(
+ mana
+ PRIVATE ${INTERNAL_LIBRARIES}
+ ${SDL2_LINK_LIBRARIES}
+ ${PNG_LIBRARIES}
+ ${PHYSFS_LIBRARY}
+ ${CURL_LIBRARIES}
+ ${LIBXML2_LIBRARIES}
+ ${GUICHAN_LIBRARIES}
+ ${OPENGL_LIBRARIES}
+ ${LIBINTL_LIBRARIES}
+ ${EXTRA_LIBRARIES})
-SET_TARGET_PROPERTIES(mana PROPERTIES
- COMPILE_FLAGS "${FLAGS}"
- MACOSX_BUNDLE TRUE
- MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
- MACOSX_BUNDLE_GUI_IDENTIFIER org.manasource.Mana
- MACOSX_BUNDLE_ICON_FILE ${APP_ICON_NAME}
- MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
- MACOSX_BUNDLE_COPYRIGHT "(C) 2004-2024 ${CPACK_PACKAGE_VENDOR}"
- MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}
- MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
+set_target_properties(
+ mana
+ PROPERTIES COMPILE_FLAGS "${FLAGS}"
+ MACOSX_BUNDLE TRUE
+ MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
+ MACOSX_BUNDLE_GUI_IDENTIFIER org.manasource.Mana
+ MACOSX_BUNDLE_ICON_FILE ${APP_ICON_NAME}
+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
+ MACOSX_BUNDLE_COPYRIGHT "(C) 2004-2024 ${CPACK_PACKAGE_VENDOR}"
+ MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING
+ ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
-INSTALL(TARGETS mana
- BUNDLE DESTINATION .
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(
+ TARGETS mana
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(APPLE)
target_link_libraries(mana PRIVATE "-framework Foundation")
- SET_TARGET_PROPERTIES(mana PROPERTIES
- OUTPUT_NAME Mana)
+ set_target_properties(mana PROPERTIES OUTPUT_NAME Mana)
set(CPACK_GENERATOR "DRAGNDROP")
- install(CODE "include(BundleUtilities)
- fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/Mana.app\" \"\" \"/usr/local/lib\")")
+ install(
+ CODE "include(BundleUtilities)
+ fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/Mana.app\" \"\" \"/usr/local/lib\")"
+ )
endif()
-IF (CMAKE_SYSTEM_NAME STREQUAL SunOS)
- # we expect the SMCgtxt package to be present on Solaris;
- # the Solaris gettext is not API-compatible to GNU gettext
- SET_TARGET_PROPERTIES(mana PROPERTIES LINK_FLAGS "-L/usr/local/lib")
-ENDIF()
+if(CMAKE_SYSTEM_NAME STREQUAL SunOS)
+ # we expect the SMCgtxt package to be present on Solaris; the Solaris gettext
+ # is not API-compatible to GNU gettext
+ set_target_properties(mana PROPERTIES LINK_FLAGS "-L/usr/local/lib")
+endif()
diff --git a/tools/dyecmd/CMakeLists.txt b/tools/dyecmd/CMakeLists.txt
index 48566648..309420d2 100644
--- a/tools/dyecmd/CMakeLists.txt
+++ b/tools/dyecmd/CMakeLists.txt
@@ -1,28 +1,29 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+cmake_minimum_required(VERSION 2.6)
-PROJECT(MANA_DYECOMMAND)
+project(MANA_DYECOMMAND)
-IF (NOT VERSION)
- SET(VERSION 1.0.0)
-ENDIF()
+if(NOT VERSION)
+ set(VERSION 1.0.0)
+endif()
-STRING(REPLACE "." " " _VERSION ${VERSION})
-SEPARATE_ARGUMENTS(_VERSION)
-LIST(LENGTH _VERSION _LEN)
-IF(NOT (_LEN EQUAL 4 OR _LEN EQUAL 3))
- MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
-ENDIF()
+string(REPLACE "." " " _VERSION ${VERSION})
+separate_arguments(_VERSION)
+list(LENGTH _VERSION _LEN)
+if(NOT (_LEN EQUAL 4 OR _LEN EQUAL 3))
+ 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)
-IF(_LEN EQUAL 4)
- LIST(GET _VERSION 3 VER_BUILD)
-ELSE()
- SET(VER_BUILD 0)
-ENDIF()
+list(GET _VERSION 0 VER_MAJOR)
+list(GET _VERSION 1 VER_MINOR)
+list(GET _VERSION 2 VER_RELEASE)
+if(_LEN EQUAL 4)
+ list(GET _VERSION 3 VER_BUILD)
+else()
+ set(VER_BUILD 0)
+endif()
# where to look for cmake modules
-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
-ADD_SUBDIRECTORY(src)
+add_subdirectory(src)
diff --git a/tools/dyecmd/src/CMakeLists.txt b/tools/dyecmd/src/CMakeLists.txt
index df20af69..f59eabe2 100644
--- a/tools/dyecmd/src/CMakeLists.txt
+++ b/tools/dyecmd/src/CMakeLists.txt
@@ -1,57 +1,44 @@
-FIND_PACKAGE(SDL REQUIRED)
-FIND_PACKAGE(SDL_image REQUIRED)
-FIND_PACKAGE(PNG REQUIRED)
-
-IF (CMAKE_COMPILER_IS_GNUCXX)
- # Help getting compilation warnings
- SET(CMAKE_CXX_FLAGS "-Wall")
- IF (WIN32)
- # This includes enough debug information to get something useful
- # from Dr. Mingw while keeping binary size down. Almost useless
- # with gdb, though.
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
- ENDIF()
-ENDIF()
-
-SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
-SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
-
-IF (CMAKE_BUILD_TYPE)
- STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
- IF((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR
- (CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo))
- SET(FLAGS "${FLAGS} -DDEBUG")
- ENDIF()
-ENDIF()
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${SDL_INCLUDE_DIR}
- ${SDLIMAGE_INCLUDE_DIR}
- ${PNG_INCLUDE_DIR}
- )
+find_package(SDL REQUIRED)
+find_package(SDL_image REQUIRED)
+find_package(PNG REQUIRED)
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+ # Help getting compilation warnings
+ set(CMAKE_CXX_FLAGS "-Wall")
+ if(WIN32)
+ # This includes enough debug information to get something useful from Dr.
+ # Mingw while keeping binary size down. Almost useless with gdb, though.
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
+ endif()
+endif()
+
+set(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
+set(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+set(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
+
+if(CMAKE_BUILD_TYPE)
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ if((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR (CMAKE_BUILD_TYPE_TOLOWER
+ MATCHES relwithdebinfo))
+ set(FLAGS "${FLAGS} -DDEBUG")
+ endif()
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${SDL_INCLUDE_DIR}
+ ${SDLIMAGE_INCLUDE_DIR} ${PNG_INCLUDE_DIR})
# Fix some stuff that gets not hidden by mainline modules
-MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR)
-MARK_AS_ADVANCED(SDLIMAGE_LIBRARY)
-MARK_AS_ADVANCED(SDLMAIN_LIBRARY)
-MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
-MARK_AS_ADVANCED(SDL_LIBRARY)
-
-SET(SRCS
- dye.cpp
- dye.h
- dyecmd.cpp
- imagewriter.cpp
- imagewriter.h
- )
-
-ADD_EXECUTABLE(dyecmd WIN32 ${SRCS})
-
-TARGET_LINK_LIBRARIES(dyecmd
- ${SDL_LIBRARY}
- ${SDLIMAGE_LIBRARY}
- ${PNG_LIBRARIES})
-
-SET_TARGET_PROPERTIES(dyecmd PROPERTIES COMPILE_FLAGS "${FLAGS}")
+mark_as_advanced(SDLIMAGE_INCLUDE_DIR)
+mark_as_advanced(SDLIMAGE_LIBRARY)
+mark_as_advanced(SDLMAIN_LIBRARY)
+mark_as_advanced(SDL_INCLUDE_DIR)
+mark_as_advanced(SDL_LIBRARY)
+
+set(SRCS dye.cpp dye.h dyecmd.cpp imagewriter.cpp imagewriter.h)
+
+add_executable(dyecmd WIN32 ${SRCS})
+
+target_link_libraries(dyecmd ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY}
+ ${PNG_LIBRARIES})
+
+set_target_properties(dyecmd PROPERTIES COMPILE_FLAGS "${FLAGS}")