diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-04-08 14:59:47 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-04-20 17:52:51 +0200 |
commit | 872a334c19615873e796175158bb93420f439492 (patch) | |
tree | d64f13a15eda42d3d10d03915cc957d5458c0436 | |
parent | b028cb59a7723ca3b7d2ffb5229750413e936e22 (diff) | |
download | mana-872a334c19615873e796175158bb93420f439492.tar.gz mana-872a334c19615873e796175158bb93420f439492.tar.bz2 mana-872a334c19615873e796175158bb93420f439492.tar.xz mana-872a334c19615873e796175158bb93420f439492.zip |
CMake: Use FindIntl
FindIntl was added with CMake 3.2 and can be used to find the Gettext
libintl headers and libraries.
I've removed special handling of Solaris, which explicitly added linking
to 'intl' and added '/usr/local/lib' include path. It can be easily
restored if necessary, once somebody tries to compile Mana on Solaris.
-rw-r--r-- | CMake/Modules/FindLibIntl.cmake | 46 | ||||
-rw-r--r-- | src/CMakeLists.txt | 27 |
2 files changed, 8 insertions, 65 deletions
diff --git a/CMake/Modules/FindLibIntl.cmake b/CMake/Modules/FindLibIntl.cmake deleted file mode 100644 index e7596052..00000000 --- a/CMake/Modules/FindLibIntl.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# Try to find the libintl library. Explicit searching is currently -# only required for Win32, though it might be useful for some UNIX -# variants, too. Therefore code for searching common UNIX include -# directories is included, too. -# -# Once done this will define -# -# LIBINTL_FOUND - system has libintl -# LIBINTL_LIBRARIES - the library needed for linking - -IF (LibIntl_LIBRARY) - SET(LibIntl_FIND_QUIETLY TRUE) -ENDIF () - -# for Windows we rely on the environement variables -# %INCLUDE% and %LIB%; FIND_LIBRARY checks %LIB% -# automatically on Windows -IF(WIN32) - FIND_LIBRARY(LibIntl_LIBRARY - NAMES intl - ) -ELSE() - FIND_LIBRARY(LibIntl_LIBRARY - NAMES intl - PATHS /usr/lib /usr/local/lib - ) -ENDIF() - -IF (LibIntl_LIBRARY) - SET(LIBINTL_FOUND TRUE) - SET(LIBINTL_LIBRARIES ${LibIntl_LIBRARY}) -ELSE () - SET(LIBINTL_FOUND FALSE) -ENDIF () - -IF (LIBINTL_FOUND) - IF (NOT LibIntl_FIND_QUIETLY) - MESSAGE(STATUS "Found libintl: ${LibIntl_LIBRARY}") - ENDIF () -ELSE () - IF (LibIntl_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find libintl") - ENDIF () -ENDIF () - -MARK_AS_ADVANCED(LibIntl_LIBRARY) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a35d6dc..1d330112 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(CURL REQUIRED) find_package(LibXml2 REQUIRED) find_package(PNG REQUIRED) find_package(Gettext REQUIRED) +find_package(Intl REQUIRED) if(CMAKE_COMPILER_IS_GNUCXX) # Help getting compilation warnings @@ -56,16 +57,6 @@ if(ENABLE_NLS) message(STATUS "i18n support enabled") 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}) @@ -80,7 +71,8 @@ include_directories( ${PHYSFS_INCLUDE_DIR} ${CURL_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} - ${GUICHAN_INCLUDE_DIR}) + ${GUICHAN_INCLUDE_DIR} + ${Intl_INCLUDE_DIRS}) set(SRCS gui/widgets/avatarlistbox.cpp @@ -631,8 +623,7 @@ target_link_libraries( ${LIBXML2_LIBRARIES} ${GUICHAN_LIBRARIES} ${OPENGL_LIBRARIES} - ${LIBINTL_LIBRARIES} - ${EXTRA_LIBRARIES}) + ${Intl_LIBRARIES}) set_target_properties( mana @@ -651,6 +642,10 @@ install( BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(WIN32) + target_link_libraries(mana PRIVATE ws2_32 winmm) +endif() + if(APPLE) target_link_libraries(mana PRIVATE "-framework Foundation") set_target_properties(mana PROPERTIES OUTPUT_NAME Mana) @@ -662,9 +657,3 @@ if(APPLE) 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() |