FLTK logo

[fltk.coredev] Using CMake to build a user app under macOS

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

Using CMake to build a user app under macOS Manolo Sep 02, 2020  
 
I'm trying to build a small FLTK-using app with cmake under macOS.
Following README.CMake.txt, section 3, I prepared this CMakeLists.txt:

cmake_minimum_required(VERSION 2.6.3)
project(small)
set(FLTK_DIR /Volumes/Extra) # the BUILD dir of FLTK
find_package(FLTK REQUIRED NO_MODULE)
add_executable(small MACOSX_BUNDLE small.cxx)
target_include_directories(small PUBLIC ${FLTK_INCLUDE_DIRS})
target_link_libraries(small fltk)

With it, the build fails at link step (compilation step is good) in that
all macOS-defined symbols are missing.
If I replace the last line of CMakeLists.txt by

      target_link_libraries(small fltk  "-framework Cocoa")

the build succeeds, and a functional macOS bundle is produced.

I had expected cmake to be smart enough to know from
find_package(FLTK REQUIRED NO_MODULE)
that "-framework Cocoa" was necessary in link commands.
Is that incorrect?

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/0aa65f43-082d-41dc-8574-d56584eef413n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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