--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -292,8 +292,9 @@
 endif()
 
 message(STATUS "Checking for certstore..")
+if(NOT QCA_SYSTEMSTORE_PATH)
 # fixme add OR mac
-if( WIN32 )
+if( MSVC )
     # USE BUILTIN
 else()
   if ( DEFINED ENV{QC_CERTSTORE_PATH} )
@@ -316,6 +317,9 @@
     endforeach (_current_try)
   endif()
 endif()
+else()
+  set(qca_CERTSTORE ${QCA_SYSTEMSTORE_PATH})
+endif()
 
 if (qca_CERTSTORE)
   message(STATUS "Found system certstore")
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,7 +50,7 @@
 	support/syncthread.cpp
 )
 
-IF (WIN32)
+IF (MSVC)
   SET( SOURCES ${SOURCES} qca_systemstore_win.cpp )
 elseif(APPLE)
   set( SOURCES ${SOURCES} qca_systemstore_mac.cpp)
--- a/src/qca_systemstore_flatfile.cpp
+++ b/src/qca_systemstore_flatfile.cpp
@@ -21,6 +21,7 @@
 #include "qca_systemstore.h"
 
 #include <QFile>
+#include <QCoreApplication>
 
 namespace QCA {
 
@@ -32,7 +33,12 @@
 
 CertificateCollection qca_get_systemstore(const QString &provider)
 {
+#ifdef Q_OS_WIN
+	QString certstore = QCoreApplication::applicationDirPath() + QStringLiteral(QCA_SYSTEMSTORE_PATH);
+	return CertificateCollection::fromFlatTextFile(certstore, nullptr, provider);
+#else
     return CertificateCollection::fromFlatTextFile(QStringLiteral(QCA_SYSTEMSTORE_PATH), nullptr, provider);
+#endif
 }
 
 }
