Commit ff905bcb authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Fix build on Widnows

Untested, but should work.
parent 235baf04
......@@ -23,6 +23,7 @@
#include <stdio.h>
#include <QFile>
#include <QDir>
#include <QCoreApplication>
extern "C" {
#include <sasl/sasl.h>
......@@ -30,13 +31,17 @@ extern "C" {
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;
#ifdef Q_OS_WIN //krazy:exclude=cpp
for (const auto &path : QCoreApplication::libraryPaths()) {
QDir dir(path);
if (dir.exists(QStringLiteral("sasl2"))) {
auto libInstallPath = QFile::encodeName(dir.absoluteFilePath(QStringLiteral("sasl2")));
if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK) {
fprintf(stderr, "SASL path initialization failed!\n");
return false;
}
break;
}
}
#endif
......
......@@ -5,6 +5,9 @@ ecm_qt_declare_logging_category(kio_ldap_PART_SRCS HEADER kldap_debug.h IDENTIFI
add_library(kio_ldap MODULE ${kio_ldap_PART_SRCS})
target_link_libraries(kio_ldap KF5::KIOCore KF5::I18n KF5::Ldap)
if (WIN32)
target_link_libraries(kio_ldap ws2_32)
endif()
set_target_properties(kio_ldap PROPERTIES OUTPUT_NAME "ldap")
install(TARGETS kio_ldap DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
......
......@@ -30,8 +30,12 @@
#include <KLocalizedString>
#include <QCoreApplication>
#ifdef Q_OS_WIN
#include <Winsock2.h>
#else
#include <netdb.h>
#include <netinet/in.h>
#endif
#include <sys/stat.h>
using namespace KIO;
......
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