Article #834: Using CMake to build an FLTK application

   
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Articles | Show Comments | Submit Comment ]

Article #834: Using CMake to build an FLTK application

Created at 08:36 Aug 10, 2008 by engelsman

The application is in src/foo.cxx, the user interface is defined in src/ui.fl and the callbacks are defined in src/callbacks.cxx.

CMakeLists.txt:

    CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

    PROJECT(example)

    FIND_PACKAGE(FLTK REQUIRED)
    FIND_PACKAGE(OpenGL REQUIRED)

    ADD_SUBDIRECTORY(src)

src/CMakeLists.txt:

    FLTK_WRAP_UI(Ui ui.fl)
    ADD_LIBRARY(Ui callbacks.cxx ${Ui_FLTK_UI_SRCS})

    ADD_EXECUTABLE(foo foo.cxx)
    ADD_DEPENDENCIES(foo Ui)
    TARGET_LINK_LIBRARIES(foo Ui)
    TARGET_LINK_LIBRARIES(foo ${FLTK_LIBRARIES})
    TARGET_LINK_LIBRARIES(foo ${OPENGL_LIBRARIES})

See