summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2022-01-12 23:05:25 +0000
committerSadie Powell <sadie@witchery.services>2022-01-12 23:05:25 +0000
commit33b42ce86edd190c44db5814967981844e96b421 (patch)
treebcbb7002d16f78265019963159483c725cd978c8 /src
parenta631028660d527f509c3b028cfa5f2903a125077 (diff)
Use the default CMake modules for finding gettext instead of our own.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/language.cpp6
-rw-r--r--src/module.cpp6
-rw-r--r--src/win32/anope_windows.h2
4 files changed, 17 insertions, 10 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d957fb6df..9c15c62dc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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()
diff --git a/src/language.cpp b/src/language.cpp
index 8c39941b4..219bf846c 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -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;
diff --git a/src/module.cpp b/src/module.cpp
index 2881c4e82..6c85284ce 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -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);
diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h
index 71d2e35db..7417b0f23 100644
--- a/src/win32/anope_windows.h
+++ b/src/win32/anope_windows.h
@@ -29,7 +29,7 @@
# define DllExport __declspec(dllimport)
#endif
-#if GETTEXT_FOUND
+#if HAVE_LOCALIZATION
/* Undefine some functions libintl defines */
# undef snprintf
# undef vsnprintf