Only link with crypt32 on Windows

crypt32 is a Windows thing, and it is used no matter the crypto
backend.
diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake
index 67f01b2..46204b5 100644
--- a/cmake/StaticBuild.cmake
+++ b/cmake/StaticBuild.cmake
@@ -34,7 +34,7 @@
     set(GNUTLS_LIBRARIES "-Wl,-Bstatic -lgnutls -ltasn1")
 
     if(NETTLE_LIBRARY)
-      set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lnettle -lhogweed -lgmp -lcrypt32")
+      set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lnettle -lhogweed -lgmp")
     endif()
     if(GCRYPT_LIBRARY)
       set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lgcrypt -lgpg-error")
@@ -42,6 +42,11 @@
 
     set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -Wl,-Bdynamic")
 
+    # GnuTLS uses various crypto-api stuff
+    if (WIN32)
+      set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lcrypt32")
+    endif()
+
     # nanosleep() lives here on Solaris
     if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
       set(GNUTLS_LIBRARIES "${GNUTLS_LIBRARIES} -lrt")