-# RPATH needs to be set correctly
-# Do this down here, since otherwise KDE wants to handle it itself, and fails
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+# Windows-specific stuff
+#####################################################################
+
+if (WIN32)
+ link_libraries(imm32 winmm dbghelp Secur32) # missing by default :/
+ if (MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX")
+ set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt")
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt")
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+ link_libraries(Version dwmapi shlwapi)
+ if (USE_QT5)
+ set(QT_QTMAIN_LIBRARY Qt5::WinMain)
+ endif()
+ endif()
+ if(HAVE_SSL AND STATIC)
+ find_package(OpenSSL REQUIRED)
+ link_libraries(${OPENSSL_LIBRARIES} ${OPENSSL_EAY_LIBRARIES})
+ endif()
+endif()
+
+
+# Static builds (very much non-portable, so don't use -DSTATIC
+# unless you know what you do!)
+#####################################################################