--- a/cli/cmdlineparser.cpp
+++ b/cli/cmdlineparser.cpp
@@ -2095,7 +2095,12 @@
 {
     if (!tryLoadLibrary(settings.library, settings.exename, "std.cfg", settings.debuglookup || settings.debuglookupLibrary)) {
         const std::string msg("Failed to load std.cfg. Your Cppcheck installation is broken, please re-install.");
-#ifdef FILESDIR
+#ifdef RELCFGDIR
+        const std::string cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(settings.exename)) + std::string(RELCFGDIR) + "/cfg");
+        const std::string details("The Cppcheck binary was compiled with RELCFGDIR set to \"" +
+                                    std::string(RELCFGDIR) +"\" and will therefore search for "
+                                    "std.cfg in " + cfgfolder);
+#elif defined FILESDIR
         const std::string details("The Cppcheck binary was compiled with FILESDIR set to \""
                                   FILESDIR "\" and will therefore search for "
                                   "std.cfg in " FILESDIR "/cfg.");
--- a/cmake/compilerDefinitions.cmake
+++ b/cmake/compilerDefinitions.cmake
@@ -68,7 +68,10 @@
     add_definitions(-DNO_WINDOWS_SEH)
 endif()
 
-if(FILESDIR_DEF)
+if (DEFINED RELCFGDIR)
+    file(TO_CMAKE_PATH ${RELCFGDIR} _relcfgdir)
+    add_definitions(-DRELCFGDIR="${_relcfgdir}")
+elseif(FILESDIR_DEF)
     file(TO_CMAKE_PATH "${FILESDIR_DEF}" _filesdir)
     add_definitions(-DFILESDIR="${_filesdir}")
 endif()
--- a/lib/addoninfo.cpp
+++ b/lib/addoninfo.cpp
@@ -48,7 +48,17 @@
     if (Path::isFile(exepath + "addons/" + fileName))
         return exepath + "addons/" + fileName;

-#ifdef FILESDIR
+#ifdef RELCFGDIR
+    const std::string cfgfolder(Path::fromNativeSeparators(exepath + std::string(RELCFGDIR)));
+    if (debug)
+        std::cout << "looking for addon '" << (cfgfolder + ("/" + fileName)) << "'" << std::endl;
+    if (Path::isFile(cfgfolder + ("/" + fileName)))
+        return cfgfolder + ("/" + fileName);
+    if (debug)
+        std::cout << "looking for addon '" << (cfgfolder + ("/addons/" + fileName)) << "'" << std::endl;
+    if (Path::isFile(cfgfolder + ("/addons/" + fileName)))
+        return cfgfolder + ("/addons/" + fileName);
+#elif defined FILESDIR
     if (debug)
         std::cout << "looking for addon '" << (FILESDIR + ("/" + fileName)) << "'" << std::endl;
     if (Path::isFile(FILESDIR + ("/" + fileName)))
--- a/lib/library.cpp
+++ b/lib/library.cpp
@@ -213,7 +101,9 @@
         if (!is_abs_path && error == tinyxml2::XML_ERROR_FILE_NOT_FOUND)
         {
             std::list<std::string> cfgfolders;
-    #ifdef FILESDIR
+    #ifdef RELCFGDIR
+            cfgfolders.emplace_back(Path::fromNativeSeparators(Path::getPathFromFilename(exename)) + std::string(RELCFGDIR) + "/cfg");
+    #elif defined FILESDIR
             cfgfolders.emplace_back(FILESDIR "/cfg");
     #endif
             if (exename) {
--- a/lib/platform.cpp
+++ b/lib/platform.cpp
@@ -209,7 +209,9 @@
             filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + fullfilename);
             filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename)) + "platforms/" + fullfilename);
         }
-#ifdef FILESDIR
+#ifdef RELCFGDIR
+        filenames.push_back(Path::fromNativeSeparators(Path::getPathFromFilename(exename)) + std::string(RELCFGDIR) + "platforms/" + filename);
+#elif defined FILESDIR
         std::string filesdir = FILESDIR;
         if (!filesdir.empty() && filesdir[filesdir.size()-1] != '/')
             filesdir += '/';
