Use string option instead of mutually exclusive bool options for charset and TLS library.

This commit is contained in:
Vincent Richard 2014-05-27 21:59:37 +02:00
parent 0a8a39a9ac
commit b5d26604ef
3 changed files with 58 additions and 59 deletions

View File

@ -652,25 +652,23 @@ OPTION(
ON
)
OPTION(
VMIME_TLS_SUPPORT_LIB_IS_GNUTLS
"Use GNU TLS library for SSL/TLS support"
ON
SET(
VMIME_TLS_SUPPORT_LIB
"gnutls"
CACHE
STRING
"Library to use for SSL/TLS conversion"
)
SET_PROPERTY(
CACHE
VMIME_TLS_SUPPORT_LIB
PROPERTY STRINGS gnutls openssl
)
OPTION(
VMIME_TLS_SUPPORT_LIB_IS_OPENSSL
"Use OpenSSL library for SSL/TLS support"
OFF
)
IF(VMIME_HAVE_TLS_SUPPORT)
IF(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS AND VMIME_TLS_SUPPORT_LIB_IS_OPENSSL)
MESSAGE(FATAL_ERROR "Options VMIME_TLS_SUPPORT_LIB_IS_GNUTLS and VMIME_TLS_SUPPORT_LIB_IS_OPENSSL are mutually exclusive (select one or the other, but not both!)")
ENDIF()
IF(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS)
IF(VMIME_TLS_SUPPORT_LIB STREQUAL "gnutls")
INCLUDE_DIRECTORIES(
${INCLUDE_DIRECTORIES}
@ -692,7 +690,10 @@ IF(VMIME_HAVE_TLS_SUPPORT)
SET(VMIME_PKGCONFIG_REQUIRES "${VMIME_PKGCONFIG_REQUIRES} gnutls")
ELSEIF(VMIME_TLS_SUPPORT_LIB_IS_OPENSSL)
SET(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS "ON")
SET(VMIME_TLS_SUPPORT_LIB_IS_OPENSSL "OFF")
ELSEIF(VMIME_TLS_SUPPORT_LIB STREQUAL "openssl")
INCLUDE_DIRECTORIES(
${INCLUDE_DIRECTORIES}
@ -709,6 +710,9 @@ IF(VMIME_HAVE_TLS_SUPPORT)
SET(VMIME_PKGCONFIG_REQUIRES "${VMIME_PKGCONFIG_REQUIRES} openssl")
SET(VMIME_TLS_SUPPORT_LIB_IS_GNUTLS "OFF")
SET(VMIME_TLS_SUPPORT_LIB_IS_OPENSSL "ON")
ELSE()
MESSAGE(FATAL_ERROR "TLS support is enabled, but no TLS/SSL library was selected/found")
@ -727,44 +731,28 @@ INCLUDE(cmake/FindICU.cmake)
FIND_PACKAGE(ICU QUIET)
IF(WIN32)
SET(VMIME_CHARSETCONV_LIB_IS_ICONV_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_ICU_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_WIN_DEFAULT "ON")
ELSEIF(ICONV_FOUND)
SET(VMIME_CHARSETCONV_LIB_IS_ICONV_DEFAULT "ON")
SET(VMIME_CHARSETCONV_LIB_IS_ICU_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_WIN_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_DETECTED "win")
ELSEIF(ICU_LIBRARIES)
SET(VMIME_CHARSETCONV_LIB_IS_ICONV_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_ICU_DEFAULT "ON")
SET(VMIME_CHARSETCONV_LIB_IS_WIN_DEFAULT "OFF")
SET(VMIME_CHARSETCONV_LIB_DETECTED "icu")
ELSEIF(ICONV_FOUND)
SET(VMIME_CHARSETCONV_LIB_DETECTED "iconv")
ENDIF()
OPTION(
VMIME_CHARSETCONV_LIB_IS_ICONV
"Use iconv library for charset conversion"
${VMIME_CHARSETCONV_LIB_IS_ICONV_DEFAULT}
SET(
VMIME_CHARSETCONV_LIB
"${VMIME_CHARSETCONV_LIB_DETECTED}"
CACHE
STRING
"Library to use for charset conversion"
)
SET_PROPERTY(
CACHE
VMIME_CHARSETCONV_LIB
PROPERTY STRINGS win iconv icu
)
OPTION(
VMIME_CHARSETCONV_LIB_IS_ICU
"Use ICU library for charset conversion"
${VMIME_CHARSETCONV_LIB_IS_ICU_DEFAULT}
)
OPTION(
VMIME_CHARSETCONV_LIB_IS_WIN
"Use Windows API for charset conversion"
${VMIME_CHARSETCONV_LIB_IS_WIN_DEFAULT}
)
IF((VMIME_CHARSETCONV_LIB_IS_ICONV AND VMIME_CHARSETCONV_LIB_IS_ICU) OR
(VMIME_CHARSETCONV_LIB_IS_ICONV AND VMIME_CHARSETCONV_LIB_IS_WIN) OR
(VMIME_CHARSETCONV_LIB_IS_ICU AND VMIME_CHARSETCONV_LIB_IS_WIN))
MESSAGE(FATAL_ERROR "Options VMIME_CHARSETCONV_LIB_IS_ICONV, VMIME_CHARSETCONV_LIB_IS_ICU and VMIME_CHARSETCONV_LIB_IS_WIN are mutually exclusive (select only one of them, but not all!)")
ENDIF()
IF(VMIME_CHARSETCONV_LIB_IS_ICONV)
IF(VMIME_CHARSETCONV_LIB STREQUAL "iconv")
INCLUDE_DIRECTORIES(
${INCLUDE_DIRECTORIES}
@ -782,7 +770,11 @@ IF(VMIME_CHARSETCONV_LIB_IS_ICONV)
SET(VMIME_PKGCONFIG_LIBS "${VMIME_PKGCONFIG_LIBS} ${ICONV_LIBRARIES}")
SET(VMIME_PKGCONFIG_CFLAGS "${VMIME_PKGCONFIG_CFLAGS} -I${ICONV_INCLUDE_DIR}")
ELSEIF(VMIME_CHARSETCONV_LIB_IS_ICU)
SET(VMIME_CHARSETCONV_LIB_IS_ICONV "ON")
SET(VMIME_CHARSETCONV_LIB_IS_ICU "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_WIN "OFF")
ELSEIF(VMIME_CHARSETCONV_LIB STREQUAL "icu")
INCLUDE_DIRECTORIES(
${INCLUDE_DIRECTORIES}
@ -800,9 +792,15 @@ ELSEIF(VMIME_CHARSETCONV_LIB_IS_ICU)
SET(VMIME_PKGCONFIG_LIBS "${VMIME_PKGCONFIG_LIBS} ${ICU_LIBRARIES}")
SET(VMIME_PKGCONFIG_CFLAGS "${VMIME_PKGCONFIG_CFLAGS} -I${ICU_INCLUDE_DIRS}")
ELSEIF(VMIME_CHARSETCONV_LIB_IS_WIN)
SET(VMIME_CHARSETCONV_LIB_IS_ICONV "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_ICU "ON")
SET(VMIME_CHARSETCONV_LIB_IS_WIN "OFF")
# Nothing to do
ELSEIF(VMIME_CHARSETCONV_LIB STREQUAL "win")
SET(VMIME_CHARSETCONV_LIB_IS_ICONV "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_ICU "OFF")
SET(VMIME_CHARSETCONV_LIB_IS_WIN "ON")
ELSE()

View File

@ -1,4 +1,5 @@
\chapter{Building and Installing VMime\label{chapter_building}}
\label{chapter_building}
\chapter{Building and Installing VMime}
% ============================================================================
\section{Introduction}
@ -137,15 +138,15 @@ Set to ON to build a static version (.a) of the library (default is ON). \\
VMIME\_BUILD\_TESTS &
Set to ON to build unit tests (default is OFF). \\
\hline
VMIME\_TLS\_SUPPORT\_LIB\_IS\_OPENSSL \\ VMIME\_TLS\_SUPPORT\_LIB\_IS\_GNUTLS &
Set either the one or the other (but not both) to ON to force using either OpenSSL
or GNU TLS as the SSL library (default depends on which libraries are available on
VMIME\_TLS\_SUPPORT\_LIB &
Set to either "openssl" or "gnutls" to force using either OpenSSL or GNU TLS
for SSL/TLS support (default depends on which libraries are available on
your system). \\
\hline
VMIME\_CHARSETCONV\_LIB\_IS\_ICONV \\ VMIME\_CHARSETCONV\_LIB\_IS\_ICU &
Set either the one or the other (but not both) to ON to force using either iconv
or ICU as the charset conversion library (default depends on which libraries are
available on your system). \\
VMIME\_CHARSETCONV\_LIB &
Set to either "iconv", "icu" or "win" (Windows only) to force using iconv, ICU
or Windows built-in API for converting between charsets (default value depends
on which libraries are available on your system). \\
\hline
CMAKE\_BUILD\_TYPE &
Set the build type: either "Release" or "Debug". In Debug build, optimizations

View File

@ -5,7 +5,7 @@ cd _build
rm -f ../CMakeCache.txt ../src/vmime/config.hpp ../src/vmime/export-static.hpp ../src/vmime/export-shared.hpp
#cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_SHARED_LIBRARY=NO
#cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES
cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES -DVMIME_BUILD_SAMPLES=YES -DVMIME_TLS_SUPPORT_LIB_IS_OPENSSL=ON -DVMIME_TLS_SUPPORT_LIB_IS_GNUTLS=OFF -DCMAKE_BUILD_TYPE=Debug
cmake .. -DCMAKE_INSTALL_PREFIX=../_install -DVMIME_BUILD_TESTS=YES -DVMIME_BUILD_SAMPLES=YES -DVMIME_TLS_SUPPORT_LIB=openssl -DCMAKE_BUILD_TYPE=Debug
cmake .. -L
make
make install