From e98d7d8df57d860058d078e085737437ed55e79e Mon Sep 17 00:00:00 2001
From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
Date: Wed, 1 Jul 2020 11:02:46 +0200
Subject: [PATCH] Fix test/help_dialog for CMake building and macOS platform.

---
 test/help_dialog.cxx | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx
index e2bc8f837..5fc2dc2c4 100644
--- a/test/help_dialog.cxx
+++ b/test/help_dialog.cxx
@@ -39,18 +39,24 @@ main(int  argc,			// I - Number of command-line arguments
 {
   Fl_Help_Dialog *help = new Fl_Help_Dialog;
   char htmlname[FL_PATH_MAX];
-  if (argc > 1) {
-    strcpy(htmlname, argv[1]);
-  } else {
 #ifdef __APPLE__
+  int i = 1;
+  while (i < argc && Fl::arg(argc, argv, i)) i++;
+  if (i < argc) {
+    strcpy(htmlname, argv[i]);
+  } else {
     // bundled apps do not set the current directory
     strcpy(htmlname, argv[0]);
     char *slash = strrchr(htmlname, '/');
     if (slash) strcpy(slash, "/../Resources/help_dialog.html");
+  }
 #else
+  if (argc > 1) {
+    strcpy(htmlname, argv[1]);
+  } else {
     strcpy(htmlname, "help_dialog.html");
-#endif
   }
+#endif
 
   help->load(htmlname);	// TODO: add error check (when load() returns int instead of void)
 
-- 
GitLab