Commit f5159077 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Fix build on Windows

parent 17d4a58c
......@@ -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
......
......@@ -34,6 +34,9 @@ add_library(kio_smtp MODULE ${kio_smtp_PART_SRCS})
target_link_libraries(kio_smtp KF5::KIOCore KF5::I18n Qt5::Network ${smtp_optional_libs})
if (WIN32)
target_link_libraries(kio_smtp ws2_32)
endif()
set_target_properties(kio_smtp PROPERTIES OUTPUT_NAME "smtp")
install(TARGETS kio_smtp DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio/ )
......
......@@ -72,7 +72,11 @@ using std::unique_ptr;
#include <string.h>
#include <stdio.h>
#include <assert.h>
#ifdef Q_OS_WIN
#include <Winsock2.h>
#else
#include <netdb.h>
#endif
extern "C" {
Q_DECL_EXPORT int kdemain(int argc, char **argv);
......
......@@ -21,8 +21,7 @@ macro(add_akonadi_isolated_test _source _path)
# based on kde4_add_unit_test
if (WIN32)
get_target_property( _loc ${_targetName} LOCATION )
set(_executable ${_loc}.bat)
set(_executable $<TARGET_FILE_DIR:${_targetName}>/${_targetName}.bat)
else()
set(_executable ${EXECUTABLE_OUTPUT_PATH}/${_targetName})
endif()
......
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