changeset 254:93a227277786

Irccd: various fixes for further cross-compilation
author David Demelier <markand@malikania.fr>
date Mon, 05 Sep 2016 12:53:13 +0200
parents 11045c180db9
children 233366c94ddb
files lib/CMakeLists.txt lib/irccd/fs.cpp lib/irccd/ini.cpp lib/irccd/net.hpp
diffstat 4 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lib/CMakeLists.txt	Sun Aug 28 14:12:32 2016 +0200
+++ b/lib/CMakeLists.txt	Mon Sep 05 12:53:13 2016 +0200
@@ -31,7 +31,6 @@
         $<BUILD_INTERFACE:${IRCCD_FAKEROOTDIR}/include>
         $<BUILD_INTERFACE:${lib_SOURCE_DIR}>
         $<INSTALL_INTERFACE:include>
-        ${OPENSSL_INCLUDE_DIR}
 )
 
 source_group(irccd FILES ${HEADERS} ${SOURCES})
@@ -48,6 +47,12 @@
     list(APPEND LIBRARIES dl)
 endif ()
 
+if (OPENSSL_FOUND)
+    list(APPEND LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
+else ()
+    list(APPEND FLAGS NET_NO_SSL)
+endif ()
+
 target_link_libraries(libirccd extern-duktape extern-ircclient extern-json extern-cppformat ${LIBRARIES})
 target_compile_definitions(libirccd PRIVATE ${FLAGS})
 
@@ -103,7 +108,7 @@
 #     NAMESPACE Irccd2::
 #     DESTINATION ${WITH_CMAKEDIR}/Irccd2
 # )
-# 
+#
 # install(
 #     FILES
 #         "${CMAKE_BINARY_DIR}/Irccd2Config.cmake"
--- a/lib/irccd/fs.cpp	Sun Aug 28 14:12:32 2016 +0200
+++ b/lib/irccd/fs.cpp	Mon Sep 05 12:53:13 2016 +0200
@@ -16,8 +16,13 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)
-#   define _CRT_SECURE_NO_WARNINGS
+#if defined(_WIN32)
+#   if !defined(_CRT_SECURE_NO_WARNINGS)
+#       define _CRT_SECURE_NO_WARNINGS
+#   endif
+#   if !defined(WIN32_LEAN_AND_MEAN)
+#       define WIN32_LEAN_AND_MEAN
+#   endif
 #endif
 
 #include <algorithm>
@@ -30,8 +35,8 @@
 
 #if defined(_WIN32)
 #   include <direct.h>
-#   include <Windows.h>
-#   include <Shlwapi.h>
+#   include <windows.h>
+#   include <shlwapi.h>
 #else
 #   include <sys/types.h>
 #   include <dirent.h>
--- a/lib/irccd/ini.cpp	Sun Aug 28 14:12:32 2016 +0200
+++ b/lib/irccd/ini.cpp	Mon Sep 05 12:53:13 2016 +0200
@@ -26,7 +26,11 @@
 
 // for PathIsRelative.
 #if defined(_WIN32)
-#  include <Shlwapi.h>
+#   if !defined(WIN32_LEAN_AND_MEAN)
+#       define WIN32_LEAN_AND_MEAN
+#   endif
+
+#   include <shlwapi.h>
 #endif
 
 #include "ini.hpp"
--- a/lib/irccd/net.hpp	Sun Aug 28 14:12:32 2016 +0200
+++ b/lib/irccd/net.hpp	Mon Sep 05 12:53:13 2016 +0200
@@ -463,8 +463,8 @@
  * specified by the user.
  */
 #if defined(_WIN32)
-#   include <WinSock2.h>
-#   include <WS2tcpip.h>
+#   include <winsock2.h>
+#   include <ws2tcpip.h>
 #else
 #   include <sys/ioctl.h>
 #   include <sys/types.h>