Attempt to link against openldap on Windows, too
authorBen Rosser <rosser.bjr@gmail.com>
Tue, 2 Feb 2016 18:28:00 +0000 (13:28 -0500)
committerBen Rosser <rosser.bjr@gmail.com>
Sat, 27 May 2017 18:00:11 +0000 (14:00 -0400)
Rewrite cmake module to remove special case for Windows.

Added some (commented out) example code to ldapauthenticator as
how we'd need to link against winldap.h, but the implementations
are sufficiently different that it's probably a waste of time.

cmake/FindLdap.cmake
src/core/ldapauthenticator.cpp
src/core/ldapauthenticator.h

index e29d6a2..2f0c0dd 100644 (file)
@@ -13,15 +13,16 @@ if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
     set(Ldap_FIND_QUIETLY TRUE)
 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
 
-if(UNIX)
-   FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
-   FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
-   FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
+#if(UNIX)
+# Attempt to link against ldap.h regardless of platform!
+FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
+FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
+FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
 
-else(UNIX)
-   FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
-   FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
-endif(UNIX)
+#else(UNIX)
+#   FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
+#   FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
+#endif(UNIX)
 
 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
    set(LDAP_FOUND TRUE)
index 90b7e89..5b62b89 100644 (file)
 #include "network.h"
 #include "quassel.h"
 
-// Link against LDAP.
+/* We should use openldap on windows if at all possible, rather than trying to
+ * write some kind of compatiblity routine.
+#ifdef Q_CC_MSVC
+#include <windows.h>
+#include <winldap.h>
+#else*/
 #include <ldap.h>
+//#endif
 
 LdapAuthenticator::LdapAuthenticator(QObject *parent)
     : Authenticator(parent),
index a0c8720..2281c68 100644 (file)
 #include "core.h"
 
 // Link against LDAP.
+/* We should use openldap on windows if at all possible, rather than trying to
+ * write some kind of compatiblity routine.
+#ifdef Q_CC_MSVC
+#include <windows.h>
+#include <winldap.h>
+#else*/
 #include <ldap.h>
+//#endif
 
 // Default LDAP server port.
 #define DEFAULT_LDAP_PORT 389