Commit 6f6a0466 authored by Laurent Montel's avatar Laurent Montel 😁

Make it compiles

parent 4ba453d3
...@@ -129,9 +129,17 @@ option(KDEPIM_RUN_ISOLATED_TESTS "Run the isolated tests." FALSE) ...@@ -129,9 +129,17 @@ option(KDEPIM_RUN_ISOLATED_TESTS "Run the isolated tests." FALSE)
add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII )
find_package(Sasl2)
set_package_properties(Sasl2 PROPERTIES
DESCRIPTION "The Cyrus-sasl library"
URL "http://www.cyrussasl.org"
TYPE OPTIONAL
)
add_subdirectory(resources) add_subdirectory(resources)
add_subdirectory(agents) add_subdirectory(agents)
#add_subdirectory(plugins) add_subdirectory(plugins)
add_subdirectory(defaultsetup) add_subdirectory(defaultsetup)
add_subdirectory(kioslave) add_subdirectory(kioslave)
add_subdirectory(migration) add_subdirectory(migration)
......
#
# - Try to find the sasl2 directory library
# Once done this will define
#
# Sasl2_FOUND - system has SASL2
# Sasl2_INCLUDE_DIRS - the SASL2 include directory
# Sasl2_LIBRARIES - The libraries needed to use SASL2
# Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Note: libsasl2.pc doesn't export the include dir.
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Sasl2 libsasl2)
find_path(Sasl2_INCLUDE_DIRS sasl/sasl.h
)
# libsasl2 add for windows, because the windows package of cyrus-sasl2
# contains a libsasl2 also for msvc which is not standard conform
find_library(Sasl2_LIBRARIES
NAMES sasl2 libsasl2
HINTS ${PC_Sasl2_LIBRARY_DIRS}
)
set(Sasl2_VERSION ${PC_Sasl2_VERSION})
if(NOT Sasl2_VERSION)
if(EXISTS ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h)
file(READ ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h SASL2_H_CONTENT)
string(REGEX MATCH "#define SASL_VERSION_MAJOR[ ]+[0-9]+" SASL2_VERSION_MAJOR_MATCH ${SASL2_H_CONTENT})
string(REGEX MATCH "#define SASL_VERSION_MINOR[ ]+[0-9]+" SASL2_VERSION_MINOR_MATCH ${SASL2_H_CONTENT})
string(REGEX MATCH "#define SASL_VERSION_STEP[ ]+[0-9]+" SASL2_VERSION_STEP_MATCH ${SASL2_H_CONTENT})
string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" SASL2_VERSION_MAJOR ${SASL2_VERSION_MAJOR_MATCH})
string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" SASL2_VERSION_MINOR ${SASL2_VERSION_MINOR_MATCH})
string(REGEX REPLACE ".*_STEP[ ]+(.*)" "\\1" SASL2_VERSION_STEP ${SASL2_VERSION_STEP_MATCH})
set(Sasl2_VERSION "${SASL2_VERSION_MAJOR}.${SASL2_VERSION_MINOR}.${SASL2_VERSION_STEP}")
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sasl2
FOUND_VAR Sasl2_FOUND
REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS
VERSION_VAR Sasl2_VERSION
)
mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION)
add_subdirectory(akonadi) add_subdirectory(akonadi)
add_subdirectory(pop3)
add_subdirectory(docs) add_subdirectory(docs)
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
set(pop3_optional_includes) set(pop3_optional_includes)
set(pop3_optional_libs) set(pop3_optional_libs)
......
/* This file is part of the KDE project
Copyright (C) 2008 Jarosław Staniek <staniek@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KIOSLAVE_COMMON_H
#define _KIOSLAVE_COMMON_H
#include <stdio.h>
#include <QFile>
#include <QDir>
extern "C" {
#include <sasl/sasl.h>
}
inline bool initSASL()
{
#ifdef Q_OS_WIN32 //krazy:exclude=cpp
QByteArray libInstallPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib") + QLatin1String("sasl2"))));
QByteArray configPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config") + QLatin1String("sasl2"))));
if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK ||
sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK) {
fprintf(stderr, "SASL path initialization failed!\n");
return false;
}
#endif
if (sasl_client_init(NULL) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
#endif
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
*/ */
#include "pop3.h" #include "pop3.h"
#include "../common.h" #include "common.h"
extern "C" { extern "C" {
#include <sasl/sasl.h> #include <sasl/sasl.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment