diff --git a/CMakeLists.txt b/CMakeLists.txt index e11601af..30e8220a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) INCLUDE(cmake/Utils.cmake) +INCLUDE(CheckIncludeFiles) INCLUDE(CheckFunctionExists) INCLUDE(CheckSymbolExists) INCLUDE(CheckTypeSize) @@ -585,6 +586,22 @@ IF(WIN32) ) 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() diff --git a/cmake/config.hpp.cmake b/cmake/config.hpp.cmake index 3d9aba92..3af17eb5 100644 --- a/cmake/config.hpp.cmake +++ b/cmake/config.hpp.cmake @@ -67,6 +67,7 @@ typedef unsigned @VMIME_32BIT_TYPE@ vmime_uint32; #cmakedefine01 VMIME_HAVE_GMTIME_R #cmakedefine01 VMIME_HAVE_LOCALTIME_S #cmakedefine01 VMIME_HAVE_LOCALTIME_R +#cmakedefine01 VMIME_HAVE_MLANG #define VMIME_SENDMAIL_PATH "@VMIME_SENDMAIL_PATH@" diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index 7e7383a2..b0e2c760 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -38,7 +38,7 @@ #include // for WSAStartup() #include -#ifdef VMIME_HAVE_MLANG_H +#if VMIME_HAVE_MLANG # include #endif @@ -117,7 +117,7 @@ const vmime::datetime windowsHandler::getCurrentLocalTime() const const vmime::charset windowsHandler::getLocaleCharset() const { -#ifdef VMIME_HAVE_MLANG_H +#if VMIME_HAVE_MLANG char szCharset[256]; CoInitialize(NULL); @@ -144,7 +144,7 @@ const vmime::charset windowsHandler::getLocaleCharset() const CoUninitialize(); return vmime::charset(szCharset); -#else // VMIME_HAVE_MLANG_H +#else // VMIME_HAVE_MLANG vmime::string ch = vmime::charsets::ISO8859_1; // default switch (GetACP())