1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 09:03:13 +02:00

Use the default CMake modules for finding gettext instead of our own.

This commit is contained in:
Sadie Powell
2022-01-12 23:05:25 +00:00
parent a631028660
commit 33b42ce86e
10 changed files with 31 additions and 42 deletions
+10 -3
View File
@@ -78,17 +78,24 @@ endif()
# Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module
add_executable(${PROGRAM_NAME} ${SRC_SRCS})
set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS} ${EXTRA_LDFLAGS}" ENABLE_EXPORTS ON INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON)
# On Windows, also link Anope to the wsock32 and Ws2_32 library, as well as set the version
if(WIN32)
target_link_libraries(${PROGRAM_NAME} wsock32 Ws2_32 ${LINK_LIBS} ${GETTEXT_LIBRARIES} ${WIN32_MEMORY})
target_link_libraries(${PROGRAM_NAME} wsock32 Ws2_32 ${LINK_LIBS} ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
else()
target_link_libraries(${PROGRAM_NAME} ${LINK_LIBS} ${GETTEXT_LIBRARIES})
target_link_libraries(${PROGRAM_NAME} ${LINK_LIBS})
endif()
# If being built with localisation we might need to link against libintl.
if(HAVE_LOCALIZATION AND Intl_LIBRARY)
target_link_libraries(${PROGRAM_NAME} ${Intl_LIBRARY})
endif()
# Building the Anope executable requires the version.h header to be generated
add_dependencies(${PROGRAM_NAME} headers)
# Also require the language files if we have gettext
if(GETTEXT_FOUND)
if(HAVE_LOCALIZATION)
add_dependencies(${PROGRAM_NAME} language)
endif()
+3 -3
View File
@@ -15,7 +15,7 @@
#include "config.h"
#include "language.h"
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
# include <libintl.h>
#endif
@@ -24,7 +24,7 @@ std::vector<Anope::string> Language::Domains;
void Language::InitLanguages()
{
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
Log(LOG_DEBUG) << "Initializing Languages...";
Languages.clear();
@@ -73,7 +73,7 @@ const char *Language::Translate(const NickCore *nc, const char *string)
return Translate(nc ? nc->language.c_str() : "", string);
}
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
#if defined(__GLIBC__) && defined(__USE_GNU_GETTEXT)
extern "C" int _nl_msg_cat_cntr;
+3 -3
View File
@@ -11,7 +11,7 @@
#include "language.h"
#include "account.h"
#ifdef GETTEXT_FOUND
#ifdef HAVE_LOCALIZATION
# include <libintl.h>
#endif
@@ -39,7 +39,7 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
ModuleManager::Modules.push_back(this);
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
for (unsigned i = 0; i < Language::Languages.size(); ++i)
{
/* Remove .UTF-8 or any other suffix */
@@ -75,7 +75,7 @@ Module::~Module()
if (it != ModuleManager::Modules.end())
ModuleManager::Modules.erase(it);
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
std::vector<Anope::string>::iterator dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name);
if (dit != Language::Domains.end())
Language::Domains.erase(dit);
+1 -1
View File
@@ -29,7 +29,7 @@
# define DllExport __declspec(dllimport)
#endif
#if GETTEXT_FOUND
#if HAVE_LOCALIZATION
/* Undefine some functions libintl defines */
# undef snprintf
# undef vsnprintf