Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G


Jump to: navigation, search
Task-specific instructions: Add section “Passing custom arguments to CMake”
{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}
=== Passing custom arguments to CMake ===
Sometimes, when building a program, you may want to enable a feature that is not enabled by default, or disable a feature that is enabled by default. With recent versions of <tt>download_and_compile.sh</tt> (April 2019 or later), the environment variables <tt>SG_CMAKEARGS</tt> and <tt>FG_CMAKEARGS</tt> allow one to do that for SimGear and FlightGear. For instance, in order to link SimGear with the system Expat library, you can do:
$ SG_CMAKEARGS='-DSYSTEM_EXPAT=ON' download_and_compile.sh SIMGEAR
Similarly, disabling HID-based input when building FlightGear can be achieved this way:
$ FG_CMAKEARGS='-DENABLE_HID_INPUT=OFF' download_and_compile.sh FGFS
{{Note|Such options are typically defined in <tt>CMakeLists.txt</tt> files, for example {{simgear source
| path = CMakeLists.txt
| text = here
}} for SimGear and {{flightgear source
| path = CMakeLists.txt
| text = here
}} for FlightGear.}}
This can be useful for instance to work around bugs in a part of SimGear or FlightGear that you don't need, but causes a build or runtime failure (see [https://forum.flightgear.org/viewtopic.php?f=45&t=35740 here] for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!
If you have several such options to pass, just use spaces to separate them inside the quotes:
Of course, the same thing can also be achieved this way in Bourne-style shells:
$ download_and_compile.sh FGFS
It is also possible to set both <tt>SG_CMAKEARGS</tt> and <tt>FG_CMAKEARGS</tt> at the same time for a given <tt>download_and_compile.sh</tt> run:
$ download_and_compile.sh
=== Launching FlightGear ===

Navigation menu