Check for MLang on Windows platform.

This commit is contained in:
Vincent Richard 2013-02-10 21:12:41 +01:00
parent 4457dec512
commit ddf3cff495
3 changed files with 21 additions and 3 deletions

View File

@ -16,6 +16,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
INCLUDE(cmake/Utils.cmake) INCLUDE(cmake/Utils.cmake)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists) INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists) INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeSize) INCLUDE(CheckTypeSize)
@ -585,6 +586,22 @@ IF(WIN32)
) )
ENDIF() ENDIF()
# MLang
CHECK_INCLUDE_FILES(Mlang.h VMIME_HAVE_MLANG_H)
CHECK_LIBRARY_EXISTS("mlang" ConvertINetString "${CMAKE_LIBRARY_PATH}" VMIME_HAVE_MLANG_LIB)
IF(VMIME_HAVE_MLANG_H)
IF(VMIME_HAVE_MLANG_LIB)
SET(VMIME_HAVE_MLANG ON)
TARGET_LINK_LIBRARIES(
${VMIME_LIBRARY_NAME}
${TARGET_LINK_LIBRARIES}
"mlang"
)
ENDIF()
ENDIF()
ENDIF() ENDIF()

View File

@ -67,6 +67,7 @@ typedef unsigned @VMIME_32BIT_TYPE@ vmime_uint32;
#cmakedefine01 VMIME_HAVE_GMTIME_R #cmakedefine01 VMIME_HAVE_GMTIME_R
#cmakedefine01 VMIME_HAVE_LOCALTIME_S #cmakedefine01 VMIME_HAVE_LOCALTIME_S
#cmakedefine01 VMIME_HAVE_LOCALTIME_R #cmakedefine01 VMIME_HAVE_LOCALTIME_R
#cmakedefine01 VMIME_HAVE_MLANG
#define VMIME_SENDMAIL_PATH "@VMIME_SENDMAIL_PATH@" #define VMIME_SENDMAIL_PATH "@VMIME_SENDMAIL_PATH@"

View File

@ -38,7 +38,7 @@
#include <winsock2.h> // for WSAStartup() #include <winsock2.h> // for WSAStartup()
#include <wincrypt.h> #include <wincrypt.h>
#ifdef VMIME_HAVE_MLANG_H #if VMIME_HAVE_MLANG
# include <mlang.h> # include <mlang.h>
#endif #endif
@ -117,7 +117,7 @@ const vmime::datetime windowsHandler::getCurrentLocalTime() const
const vmime::charset windowsHandler::getLocaleCharset() const const vmime::charset windowsHandler::getLocaleCharset() const
{ {
#ifdef VMIME_HAVE_MLANG_H #if VMIME_HAVE_MLANG
char szCharset[256]; char szCharset[256];
CoInitialize(NULL); CoInitialize(NULL);
@ -144,7 +144,7 @@ const vmime::charset windowsHandler::getLocaleCharset() const
CoUninitialize(); CoUninitialize();
return vmime::charset(szCharset); return vmime::charset(szCharset);
#else // VMIME_HAVE_MLANG_H #else // VMIME_HAVE_MLANG
vmime::string ch = vmime::charsets::ISO8859_1; // default vmime::string ch = vmime::charsets::ISO8859_1; // default
switch (GetACP()) switch (GetACP())