FLUID: command line argument -v shows fltk version at build time

This commit is contained in:
Matthias Melcher 2024-12-09 22:04:11 +01:00
parent eb4d8d4957
commit 9a80eeccb4

View File

@ -168,6 +168,9 @@ int compile_file = 0; // fluid -c
/// Set, if Fluid was started with the command line argument -cs
int compile_strings = 0; // fluid -cs
/// Set, if Fluid was started with the command line argument -v
int show_version = 0; // fluid -v
/// Set, if Fluid runs in batch mode, and no user interface is activated.
int batch_mode = 0; // if set (-c, -u) don't open display
@ -2113,6 +2116,10 @@ static int arg(int argc, char** argv, int& i) {
batch_mode++;
i++; return 1;
}
if (argv[i][1] == 'v' && !argv[i][2]) {
show_version = 1;
i++; return 1;
}
if (argv[i][1] == 'c' && argv[i][2] == 's' && !argv[i][3]) {
compile_file++;
compile_strings++;
@ -2204,6 +2211,7 @@ int main(int argc,char **argv) {
" -cs : write .cxx and .h and strings and exit\n"
" -o <name> : .cxx output filename, or extension if <name> starts with '.'\n"
" -h <name> : .h output filename, or extension if <name> starts with '.'\n"
" -v : print FLUID version number\n"
" -d : enable internal debugging\n";
const char *app_name = NULL;
if ( (argc > 0) && argv[0] && argv[0][0] )
@ -2217,6 +2225,10 @@ int main(int argc,char **argv) {
#endif
return 1;
}
if (show_version) {
printf("FLUID version %d.%d.%d\n", FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION);
::exit(0);
}
const char *c = NULL;
if (g_autodoc_path.empty())