CMake 3.23.0 build with MinGW-w64 fails with GetAppExecLink() issue

Building CMake 3.23.0 with MinGW-w64 (in my case native on Windows using the standalone build from fails because GetAppExecLink() is not defined.
I was able to build after applying the path below.

patch -ulbf Source/kwsys/SystemTools.cxx << EOF
@@ -102,5 +102,6 @@
 // Windows API.
-#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #  include <windows.h>
 #  include <winioctl.h>
+# if !defined(__MINGW32__)
@@ -158,2 +159,3 @@
+# endif

@@ -162,2 +164,3 @@
+# if !defined(__MINGW32__)
   // We only know the layout of version 3.
@@ -166,2 +169,3 @@
+# endif


CMake 3.23.0 builds fine with MinGW64 tooling on MSYS2’s distribution. That also defines __MINGW32__. We cannot remove the support for that platform.

FWIW, I don’t see the code #if defined(_WIN32) && !defined(__MINGW32__) on the quoted diff in the 3.23.0 source here.

In the source code tarball I downloaded from that code was there, while in your link it just says #if defined(_WIN32).

Is it possible the tarball doesn’t exactly match the release code?

The line I linked is:

$ curl -OL
$ sha256sum cmake-3.23.0.tar.gz
5ab0a12f702f44013be7e19534cd9094d65cc9fe7b2cd0f8c9e5318e0fe4ac82  cmake-3.23.0.tar.gz
$ tar xvf cmake-3.23.0.tar.gz -- cmake-3.23.0/Source/kwsys/SystemTools.cxx
$ sed -n '98 p' cmake-3.23.0/Source/kwsys/SystemTools.cxx
#if defined(_WIN32)

My bad, it looks like my build process had an old patch in place to fix Source/kwsys/SystemTools.cxx, which actually broke this version. The good news is that patch is now no longer needed in 3.23.0.

Great! Thanks for reporting back.