--- a/build/cmake/config.cmake
+++ b/build/cmake/config.cmake
@@ -205,7 +205,7 @@
     set(WXCONFIG_RESFLAGS)
     set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir")
     set(LDFLAGS_GL)
-    set(RESCOMP)
+    get_filename_component(RESCOMP "${CMAKE_RC_COMPILER}" NAME_WE)
 
     wx_configure_script(
         "wx-config.in"
