Re: [fltk/fltk] Provide easier instructions for modern CMake (#164)
Albrecht Schlosser
Nov 23, 2020
Well, I tried it myself and for me it didn't work w/o specifying both include dirs. I only tested under Linux, but with both make and ninja (both failed). Everything worked fine with the include dirs. I also removed the GUI_TYPE variable and set both GUI attributes in the add_executable() statement. The resultant (shorter) file is then (with hello.cxx as source file):
cmake_minimum_required(VERSION 3.14)
project(app)
include(FetchContent)
set(FLTK_BUILD_TEST OFF CACHE BOOL " " FORCE)
if(UNIX AND NOT APPLE)
set(OPTION_USE_PANGO ON CACHE BOOL " " FORCE)
endif()
FetchContent_Declare(FLTK
GIT_REPOSITORY https://github.com/fltk/fltk
)
FetchContent_MakeAvailable(FLTK)
add_executable(main WIN32 MACOSX_BUNDLE hello.cxx)
target_include_directories(main PRIVATE ${fltk_BINARY_DIR} ${fltk_SOURCE_DIR})
target_link_libraries(main PRIVATE fltk) # if needed: fltk_gl fltk_images fltk_png fltk_jpeg fltk_z
if(APPLE)
target_link_libraries(main PRIVATE "-framework Cocoa") # need for Darwin
endif()
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
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'.