source_group("Main\\Headers" FILES ${HEADERS})
source_group("Main\\Sources" FILES ${SOURCES})
-add_executable(fgfs ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+
+# important we pass WIN32 here so the console is optional. Other
+# platforms ignore this option. If a console is needed we allocate
+# it manually via AllocConsole()
+add_executable(fgfs WIN32 ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
#message(STATUS "fg libs ${FG_LIBS}")
{
fgFindAircraftInDir(path, this, &ShowAircraft::processAircraft);
+ simgear::requestConsole(); // ensure console is shown on Windows
+
std::sort(_aircraft.begin(), _aircraft.end(), ciLessLibC());
- SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on Windows
cout << "Available aircraft:" << endl;
for ( unsigned int i = 0; i < _aircraft.size(); i++ ) {
cout << _aircraft[i] << endl;
} fgOptionArray[] = {
{"language", true, OPTION_IGNORE, "", false, "", 0 },
+ {"console", false, OPTION_IGNORE, "", false, "", 0 },
{"disable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", false, "", 0 },
{"enable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", true, "", 0 },
{"renderer", true, OPTION_STRING, "/sim/rendering/rembrandt/renderer", false, "", 0 },
} else if ( (s == "--verbose") || (s == "-v") ) {
// verbose help/usage request
return FG_OPTIONS_VERBOSE_HELP;
+ } else if ((s == "--console") || (s == "-c")) {
+ simgear::requestConsole();
+ return FG_OPTIONS_OK;
} else if (s.find("-psn") == 0) {
// on Mac, when launched from the GUI, we are passed the ProcessSerialNumber
// as an argument (and no others). Silently ignore the argument here.
FGLocale *locale = globals->get_locale();
SGPropertyNode options_root;
- SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on Windows
+ simgear::requestConsole(); // ensure console is shown on Windows
cout << endl;
try {
if ( !(base_version == required_version) ) {
// tell the operator how to use this application
- SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on windows
+ simgear::requestConsole(); // ensure console is shown on Windows
+
cerr << endl << "Base package check failed:" << endl \
<< " Version " << base_version << " found at: " \
<< globals->get_fg_root() << endl \