0

I'm just getting started on a project with wxWidgets, and I'm trying to set up a Bakefile for cross-platform compilation. I need to pass the output of wx-config --libs and wx-config --cxxflags to the compiler.

How can I accomplish this? I cannot find anything in the Bakefile docs about getting the output of a command into a variable. Backticks don't seem to work:

myvar = `wx-config --libs`
#=> bakefile.bkl:2:12: error: no viable alternative at character u'`'
JJJollyjim
  • 5,837
  • 19
  • 56
  • 78

1 Answers1

0

You need to use quotes here, i.e.

myvar = "`wx-config --libs`"

For the reference, here is what I do in my own bakefiles:

if ( $toolset == gnu || $toolset == gnu-osx ) {
    setting WX_CONFIG {
        default = wx-config;
        help = "Path to the wx-config script";
    }

    compiler-options += "`$(WX_CONFIG) --cppflags`";
    link-options += "`$(WX_CONFIG) --libs`";
}

This allows to do things like make WX_CONFIG=/full/path/to/wx-config which is handy when using an uninstalled version of wxWidgets.

VZ.
  • 21,740
  • 3
  • 39
  • 42