[CMake] Document usage of .fl files w/o fltk_wrap_ui (STR #3281).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11113 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
6f49c3e419
commit
604dd63b45
@ -282,25 +282,40 @@ The built-in libraries (if built):
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
CMake has a command named fltk_wrap_ui which helps deal with fluid *.fl
|
CMake has a command named fltk_wrap_ui which helps deal with fluid *.fl
|
||||||
files. An example of its use is in test/CMakeLists.txt. Here is a short
|
files. Unfortunately it is broken in CMake 3.4.x. You can however use
|
||||||
summary on its use.
|
add_custom_command to achieve the same result.
|
||||||
|
This is a more basic approach and should work for all CMake versions.
|
||||||
|
|
||||||
Set a variable to list your C++ files, say CPPFILES.
|
Here is a sample CMakeLists.txt which compiles the CubeView example from
|
||||||
Set another variable to list your *.fl files, say FLFILES.
|
a directory you've copied the test/Cube* files to.
|
||||||
Say your executable will be called exec.
|
|
||||||
|
|
||||||
Then this is what you do...
|
---
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
fltk_wrap_ui(exec ${FLFILES})
|
project(CubeView)
|
||||||
add_executable(exec WIN32 ${CPPFILES} ${exec_FLTK_UI_SRCS})
|
|
||||||
|
|
||||||
fltk_wrap_ui calls fluid and generates the required C++ files from the *.fl
|
# change this to your fltk buid directory
|
||||||
files. It sets the variable, in this case exec_FLTK_UI_SRCS, to the
|
set(FLTK_DIR /home/msurette/build/fltk-release/)
|
||||||
list of generated files for inclusion in the add_executable command.
|
|
||||||
|
|
||||||
The variable FLTK_FLUID_EXECUTABLE which is needed by fltk_wrap_ui is set
|
find_package(FLTK REQUIRED NO_MODULE)
|
||||||
when find_package(FLTK REQUIRED NO_MODULE) succeeds.
|
include(${FLTK_USE_FILE})
|
||||||
|
|
||||||
|
#run fluid -c to generate CubeViewUI.cxx and CubeViewUI.h files
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "CubeViewUI.cxx" "CubeViewUI.h"
|
||||||
|
COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/CubeViewUI.fl
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_BINARY_DIR})
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR})
|
||||||
|
add_executable(CubeView WIN32 CubeMain.cxx CubeView.cxx CubeViewUI.cxx)
|
||||||
|
|
||||||
|
target_link_libraries(CubeView fltk fltk_gl)
|
||||||
|
---
|
||||||
|
|
||||||
|
You can repeat the add_custom_command for each fluid file or if you have
|
||||||
|
a large number of them see the CMake/macros.cmake function FLTK_RUN_FLUID
|
||||||
|
for an example of how to run it in a loop.
|
||||||
|
|
||||||
DOCUMENT HISTORY
|
DOCUMENT HISTORY
|
||||||
==================
|
==================
|
||||||
@ -309,3 +324,4 @@ Dec 20 2010 - matt: merged and restructures
|
|||||||
May 15 2013 - erco: small formatting tweaks, added some examples
|
May 15 2013 - erco: small formatting tweaks, added some examples
|
||||||
Feb 23 2014 - msurette: updated to reflect changes to the CMake files
|
Feb 23 2014 - msurette: updated to reflect changes to the CMake files
|
||||||
Apr 07 2015 - AlbrechtS: update use example and more docs
|
Apr 07 2015 - AlbrechtS: update use example and more docs
|
||||||
|
Jan 31 2016 - msurette: custom command instead of fltk_wrap_ui
|
||||||
|
Loading…
Reference in New Issue
Block a user