]> de.git.xonotic.org Git - xonotic/netradiant.git/commit - tools/quake2/qdata_heretic2/CMakeLists.txt
cmake: make tools target the console subsystem on Windows
authorThomas Debesse <dev@illwieckz.net>
Thu, 4 Jul 2019 23:57:34 +0000 (01:57 +0200)
committerThomas Debesse <dev@illwieckz.net>
Fri, 5 Jul 2019 20:26:18 +0000 (22:26 +0200)
commitf2f321e97f89c45980cd63d70f98331b484fec1c
treebcf1e17d7afa17e588abb294b2ff1a3d2e8ab664
parent7f395ee920ea60ff60e0ab26b11f73cd28aca265
cmake: make tools target the console subsystem on Windows

previously on Windows the stdout stuff was only printed on MinTTY console or SSH shell,
this change makes the tools to target the console subsystem so they also print stdout
on cmd console.

this also makes the tool spawning a cmd console windows when not started from a console,
allowing people to monitor what is printed.

this is done by adding a console_app() cmake macro that enables the -mconsole linker flag.
For exhaustivity an extraneous window_app() macro is done too that enables the -mwindows
flag. The -mwindows looks to be implicit, but making this macro explicit and using it
keeps the CMakeLists.txt file self documenting which exe has to be compiled with -mconsole,
which one has to be compiled with -mwindows, and which one has to be compiled with both.

this is a way to check if an exe targets only the windows subsystem:

$ objdump -p netradiant.exe | egrep '^Subsystem'
Subsystem 00000002 (Windows GUI)

this is a way to check if an exe targets the console subsystem:

$ objdump -p q3map2.exe | egrep '^Subsystem'
Subsystem 00000003 (Windows CUI)

note that this one targets both console and windows subsystem, only console is reported:

$ objdump -p q2map.exe | egrep '^Subsystem'
Subsystem 00000003 (Windows CUI)
CMakeLists.txt
radiant/CMakeLists.txt
tools/quake2/CMakeLists.txt
tools/quake2/qdata_heretic2/CMakeLists.txt
tools/quake3/CMakeLists.txt