FLTK logo

[master] bb099ad - Basic CMakeLists.txt file to build FLTK-based user program - continued

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] bb099ad - Basic CMakeLists.txt file to build FLTK-based user program - continued "ManoloFLTK" Nov 24, 2020  
 
commit bb099ade19480327b00a23e212e59b018161ab44
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Tue Nov 24 10:05:20 2020 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Tue Nov 24 10:05:36 2020 +0100

    Basic CMakeLists.txt file to build FLTK-based user program - continued
    
    A single add_executable() command is possible.

 README.CMake.txt | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git README.CMake.txt README.CMake.txt
index ca09e92..abba89f 100644
--- README.CMake.txt
+++ README.CMake.txt
@@ -471,11 +471,9 @@ set(FLTK_DIR /path/to/fltk)
 
 find_package(FLTK REQUIRED NO_MODULE)
 
+add_executable(hello WIN32 MACOSX_BUNDLE hello.cxx)
 if (APPLE)
-  add_executable(hello MACOSX_BUNDLE hello.cxx)
   target_link_libraries(hello "-framework cocoa")
-else ()
-  add_executable(hello WIN32 hello.cxx)
 endif (APPLE)
 
 target_include_directories(hello PUBLIC ${FLTK_INCLUDE_DIRS})
@@ -491,8 +489,9 @@ means that it is an error if it's not found.  NO_MODULE tells it to search
 only for the FLTKConfig file, not using the FindFLTK.cmake supplied with
 CMake, which doesn't work with this version of FLTK.
 
-The add_executable() command takes one form for the macOS platform
-and another for other platforms (Yes, WIN32 can be used also for the X11 platform).
+The "WIN32 MACOSX_BUNDLE" in the add_executable tells this is
+a GUI app.  It is ignored on other platforms and should always be
+present with FLTK GUI programs for better portability.
 
 Once the package is found the CMake variable FLTK_INCLUDE_DIRS is defined
 which can be used to add the FLTK include directories to the definitions
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.