Building CMake 3.23.0 with MinGW-w64 (in my case native on Windows using the standalone build from https://winlibs.com/) 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__)
# ifndef INVALID_FILE_ATTRIBUTES
@@ -158,2 +159,3 @@
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
+# endif
@@ -162,2 +164,3 @@
{
+# if !defined(__MINGW32__)
// We only know the layout of version 3.
@@ -166,2 +169,3 @@
}
+# endif
EOF
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.