wx-config windows port - Other Windows IDEs

wx-config-win is a tiny implementation of wx-config for Windows compilers.

Home | Issue tracker | Source | Download

Support of `backticks` in other Windows IDEs

MSVC projects

Altrough you can simulate backticks in MSVC projects using the so-called response files, it seems that only compiler flags can use them, not linker flags.

This needs more research to see if a workaround can be done. Until that, the best you can do is use response files for compiler flags, and paste the output of wx-config --libs in the linker options.

MSVC makefiles (based on the info from GTK+ for Windows)

If you are a MSVC user and use nmake, it's a bit more complicated. 

nmake (or the standard Windows command interpreter it uses, command.com or cmd.exe) doesn't support backticks. You must run wx-config manually, and paste its output into your nmake makefile.

On NT/2k/XP, it is possible to have nmake create temporary files containing the output from wx-config, and use those in a nmake makefile like this:

foobar.exe: foobar.obj __wx_libs.mak
cl foobar.obj @__wx_libs.mak
@del wx_libs.mak

foobar.obj: foobar.cpp __wx_cflags.mak
cl -c @__wx_cflags.mak foobar.cpp
@del __wx_cflags.mak

__wx_cflags.mak:
wx-config --cflags >$@

__wx_libs.mak:
for /F "delims==" %i in ('wx-config --libs') \
do echo /link %i >$@

Note in the above makefile fragment that the __wx_libs.mak file is created using the for /F syntax available only in the cmd.exe command interpreter on NT/2k/XP. These obscure acrobatics are needed because we want __wx_libs.mak to contain a line that starts with /link, but wx-config cannot output the /link flag itself as a cl command line might contain several invokations of wx-config --libs. We cannot put the /link on the cl command line that links foobar.exe either, as cl then gets confused and runs the linker with a command file that on one line has @__wx_libs.mak, and link.exe doesn't like that.