summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2024-02-14 17:06:10 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2024-02-14 17:06:10 +0100
commit7992b0b9abbb85504995c9fee46c9484e7948f56 (patch)
tree5ecefd2e507ccf3f477072a65b6902cb8f64ab65 /fluid
parentcd3cb62770956a2c7f96465e0c2424beb2fcbc00 (diff)
CMake: fix installation on macOS
fluid and fltk-options are now installed correctly as bundles and as stand-alone executables side by side in the 'bin' folder relative to CMAKE_INSTALL_PREFIX. This works but the installation folders may be changed in the future. Targets fltk::fluid is now exported correctly so find_package(FLTK CONFIG ...) works with both the build folder and an installed version.
Diffstat (limited to 'fluid')
-rw-r--r--fluid/CMakeLists.txt48
1 files changed, 21 insertions, 27 deletions
diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt
index 66f16a99f..7a9f85ddf 100644
--- a/fluid/CMakeLists.txt
+++ b/fluid/CMakeLists.txt
@@ -194,40 +194,34 @@ endforeach()
if(APPLE AND NOT FLTK_BACKEND_X11)
- # On macOS, Fluid must be installed twice. The bundled version of Fluid needs
- # to go into the /Applications folder to make it visible as a user App with
- # full GUI. The binary without bundle should go into ${FLTK_BINDIR}, usually
- # /usr/local/bin, so it will be picked up as a command line tool by
- # the build process of other apps.
- # On macOS the command line tool is the same target ('fluid') as the one
- # included in the bundle.
-
- # create bundle
+ # On macOS, fluid will be installed twice:
+ # - The bundled version of Fluid goes into the destination folder ${FLTK_BINDIR}.
+ # - The binary without bundle goes into ${FLTK_BINDIR} as well.
+ # The command line tool is the same executable as the one included in the bundle.
+ # Note:
+ # Both the bundle and the commandline tool are currently installed side by side.
+ # This may be changed in the future.
+
+ # Set bundle properties
set_target_properties(fluid PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fluid.plist")
set_target_properties(fluid PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
set_target_properties(fluid PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.fltk.fluid")
- # The line below would wrongly install /Applications/fluid.icns
- # ## set_target_properties(fluid PROPERTIES RESOURCE ${ICON_PATH})
+ # Install command line tool
+ install(PROGRAMS $<TARGET_FILE:fluid>
+ DESTINATION ${FLTK_BINDIR})
- # install fluid GUI and commandline tools
- # install(TARGETS fluid DESTINATION "/Applications")
-
- # install command line tool
- install(PROGRAMS $<TARGET_FILE:fluid> DESTINATION ${FLTK_BINDIR})
-
-else()
-
- # install Fluid GUI and optional commandline tool 'fluid-cmd' (only on Windows)
+endif(APPLE AND NOT FLTK_BACKEND_X11)
- install(TARGETS ${TARGETS}
- EXPORT FLTK-Targets
- RUNTIME DESTINATION ${FLTK_BINDIR}
- LIBRARY DESTINATION ${FLTK_LIBDIR}
- ARCHIVE DESTINATION ${FLTK_LIBDIR}
- )
+# Install the GUI and (on Windows only) the commandline tool 'fluid-cmd'
-endif(APPLE AND NOT FLTK_BACKEND_X11)
+install(TARGETS ${TARGETS}
+ EXPORT FLTK-Targets
+ RUNTIME DESTINATION ${FLTK_BINDIR}
+ LIBRARY DESTINATION ${FLTK_LIBDIR}
+ ARCHIVE DESTINATION ${FLTK_LIBDIR}
+ BUNDLE DESTINATION ${FLTK_BINDIR} # macOS: bundles
+)
# Install desktop files