Le 07/03/2022 13:34, sisyphus a écrit :
On Mon, Mar 7, 2022 at 6:27 PM Gisle Vanem <gisle.va...@gmail.com> wrote:
> A command that displays only the value of __MINGW64_VERSION_MAJOR would
> probably suffice.

Some .bat-file with:

setlocal
set %find=%WinDir%\system32\find.exe
if %MINGW32%. == . set MINGW32=f:\MinGW32\TDM-gcc

type "%MINGW32%\x86_64-w64-mingw32\include\_mingw_mac.h" | ^
   %find% "__MINGW64_VERSION_MAJOR" | %find% "#define")

------------------


Thank you, Gisle - that sounds like a good place to start.

Unfortunately that approach gives me output of (eg):
#define __MINGW64_VERSION_MAJOR 8

whereas I'm hoping to obtain just the value of __MINGW64_VERSION_MAJOR ,
and nothing else. (I want to retrieve that value inside a Makefile that
will be run in a cmd.exe shell.)

According to
https://superuser.com/questions/1488014/batch-file-extract-number-from-string-using-regex
there is some regex capability with batch files.
Not sure if there's a solution for me in that, but I'll investigate that
possibility.

You can ask GCC itself:

$ x86_64-w64-mingw32-gcc -E -include windows.h - <<<"__MINGW64_VERSION_MAJOR" | tail -n 1
9

Regards,

Stephen


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to