summaryrefslogtreecommitdiff
path: root/README.CMake.txt
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2016-02-02 00:49:51 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2016-02-02 00:49:51 +0000
commit604dd63b45231fdc84400fb568e1c5da05a5c770 (patch)
tree844a139b6603de191cb32d0ab2449668997e316e /README.CMake.txt
parent6f49c3e4198ccb420da0fee755874207546b8bcc (diff)
[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
Diffstat (limited to 'README.CMake.txt')
-rw-r--r--README.CMake.txt42
1 files changed, 29 insertions, 13 deletions
diff --git a/README.CMake.txt b/README.CMake.txt
index 0b1acadb9..91b137fa8 100644
--- a/README.CMake.txt
+++ b/README.CMake.txt
@@ -282,25 +282,40 @@ The built-in libraries (if built):
-------------------
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
-summary on its use.
+files. Unfortunately it is broken in CMake 3.4.x. You can however 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.
-Set another variable to list your *.fl files, say FLFILES.
-Say your executable will be called exec.
+Here is a sample CMakeLists.txt which compiles the CubeView example from
+a directory you've copied the test/Cube* files to.
-Then this is what you do...
+---
+cmake_minimum_required(VERSION 2.6)
+
+project(CubeView)
+
+# change this to your fltk buid directory
+set(FLTK_DIR /home/msurette/build/fltk-release/)
+
+find_package(FLTK REQUIRED NO_MODULE)
+include(${FLTK_USE_FILE})
-fltk_wrap_ui(exec ${FLFILES})
-add_executable(exec WIN32 ${CPPFILES} ${exec_FLTK_UI_SRCS})
+#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
+)
-fltk_wrap_ui calls fluid and generates the required C++ files from the *.fl
-files. It sets the variable, in this case exec_FLTK_UI_SRCS, to the
-list of generated files for inclusion in the add_executable command.
+include_directories(${CMAKE_BINARY_DIR})
+include_directories(${CMAKE_SOURCE_DIR})
+add_executable(CubeView WIN32 CubeMain.cxx CubeView.cxx CubeViewUI.cxx)
-The variable FLTK_FLUID_EXECUTABLE which is needed by fltk_wrap_ui is set
-when find_package(FLTK REQUIRED NO_MODULE) succeeds.
+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
==================
@@ -309,3 +324,4 @@ Dec 20 2010 - matt: merged and restructures
May 15 2013 - erco: small formatting tweaks, added some examples
Feb 23 2014 - msurette: updated to reflect changes to the CMake files
Apr 07 2015 - AlbrechtS: update use example and more docs
+Jan 31 2016 - msurette: custom command instead of fltk_wrap_ui