summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMake/FLTK-Functions.cmake7
-rw-r--r--CMake/FLTKConfig.cmake.in2
-rw-r--r--CMake/export.cmake22
-rw-r--r--CMake/fl_create_example.cmake8
-rw-r--r--CMake/install.cmake15
-rw-r--r--CMake/options.cmake1
-rw-r--r--CMakeLists.txt10
-rw-r--r--README.CMake.txt3
8 files changed, 47 insertions, 21 deletions
diff --git a/CMake/FLTK-Functions.cmake b/CMake/FLTK-Functions.cmake
index 460f89fbf..009653721 100644
--- a/CMake/FLTK-Functions.cmake
+++ b/CMake/FLTK-Functions.cmake
@@ -22,6 +22,12 @@
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
function (FLTK_RUN_FLUID TARGET SOURCES)
+
+ if (NOT FLTK_FLUID_EXECUTABLE)
+ message (WARNING "Not building ${SOURCES}. FLUID executable not found.")
+ return ()
+ endif (NOT FLTK_FLUID_EXECUTABLE)
+
set (CXX_FILES)
foreach (src ${SOURCES})
if ("${src}" MATCHES "\\.fl$")
@@ -36,6 +42,7 @@ function (FLTK_RUN_FLUID TARGET SOURCES)
endif ("${src}" MATCHES "\\.fl$")
endforeach ()
set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
+
endfunction (FLTK_RUN_FLUID TARGET SOURCES)
#######################################################################
diff --git a/CMake/FLTKConfig.cmake.in b/CMake/FLTKConfig.cmake.in
index e2de914e4..fb722c124 100644
--- a/CMake/FLTKConfig.cmake.in
+++ b/CMake/FLTKConfig.cmake.in
@@ -10,7 +10,7 @@
# FLTK_INCLUDE_DIRS - FLTK include directories
# FLTK_LIBRARIES - list of FLTK libraries built (not yet implemented)
# FLTK_FLUID_EXECUTABLE - needed by the function FLTK_RUN_FLUID
-# (or the deprecated fltk_wrap_ui() CMake command)
+# (or the deprecated fltk_wrap_ui() CMake command)
#
# It defines the following deprecated variables for backwards
# compatibility (do not use for new projects):
diff --git a/CMake/export.cmake b/CMake/export.cmake
index 9f8170051..828d4370d 100644
--- a/CMake/export.cmake
+++ b/CMake/export.cmake
@@ -21,16 +21,7 @@
# Set the fluid executable path used to create .cxx/.h from .fl files
-if (CMAKE_CROSSCOMPILING)
- # find a fluid executable on the host system
- find_file(FLUID_PATH
- NAMES fluid fluid.exe
- PATHS ENV PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
- set (FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
- set (FLUID_EXPORT "") # don't export fluid
-else ()
+if (FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
# use the fluid executable we build
if (WIN32)
set (FLTK_FLUID_EXECUTABLE fluid-cmd)
@@ -39,7 +30,16 @@ else ()
set (FLTK_FLUID_EXECUTABLE fluid)
set (FLUID_EXPORT fluid) # export fluid
endif ()
-endif (CMAKE_CROSSCOMPILING)
+else ()
+ # find a fluid executable on the host system
+ find_file(FLUID_PATH
+ NAMES fluid fluid.exe
+ PATHS ENV PATH
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+ set (FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
+ set (FLUID_EXPORT "") # don't export fluid
+endif (FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
# generate FLTK-Targets.cmake for build directory use
export (TARGETS ${FLUID_EXPORT} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
diff --git a/CMake/fl_create_example.cmake b/CMake/fl_create_example.cmake
index 09c99ec44..1e3f28e13 100644
--- a/CMake/fl_create_example.cmake
+++ b/CMake/fl_create_example.cmake
@@ -50,7 +50,7 @@
#
################################################################################
-macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
+function (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
set (srcs) # source files
set (flsrcs) # fluid source (.fl) files
@@ -91,6 +91,10 @@ macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
# generate source files from .fl files, add output to sources
if (flsrcs)
+ if (NOT FLTK_FLUID_EXECUTABLE)
+ message(STATUS "Example app \"${NAME}\" will not be built. FLUID executable not found.")
+ return ()
+ endif ()
FLTK_RUN_FLUID (FLUID_SOURCES "${flsrcs}")
list (APPEND srcs ${FLUID_SOURCES})
unset (FLUID_SOURCES)
@@ -176,4 +180,4 @@ macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
# *unused* # endforeach ()
# *unused* # endif ()
-endmacro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
+endfunction ()
diff --git a/CMake/install.cmake b/CMake/install.cmake
index bdd622d92..0487f58cb 100644
--- a/CMake/install.cmake
+++ b/CMake/install.cmake
@@ -122,14 +122,17 @@ if (UNIX OR MSYS OR MINGW)
)
endmacro (INSTALL_MAN FILE LEVEL)
- INSTALL_MAN (fluid 1)
+ if (FLTK_BUILD_FLUID)
+ INSTALL_MAN (fluid 1)
+ endif (FLTK_BUILD_FLUID)
INSTALL_MAN (fltk-config 1)
INSTALL_MAN (fltk 3)
- # Don't (!) install man pages of games (GitHub issue #23)
-
- # INSTALL_MAN (blocks 6)
- # INSTALL_MAN (checkers 6)
- # INSTALL_MAN (sudoku 6)
+ if (FLTK_BUILD_TEST AND FLTK_BUILD_FLUID)
+ # Don't (!) install man pages of games (GitHub issue #23)
+ # INSTALL_MAN (blocks 6)
+ # INSTALL_MAN (checkers 6)
+ # INSTALL_MAN (sudoku 6)
+ endif ()
endif (UNIX OR MSYS OR MINGW)
diff --git a/CMake/options.cmake b/CMake/options.cmake
index 771b3030e..b56ed77af 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -301,6 +301,7 @@ option (OPTION_BUILD_SHARED_LIBS
option (OPTION_PRINT_SUPPORT "allow print support" ON)
option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
+option (FLTK_BUILD_FLUID "Build FLUID" ON)
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9fb8cac43..2fcac4269 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,7 +111,9 @@ add_subdirectory(src)
# build fluid
#######################################################################
-add_subdirectory(fluid)
+if (FLTK_BUILD_FLUID)
+ add_subdirectory (fluid)
+endif (FLTK_BUILD_FLUID)
#######################################################################
# variables shared by export and install
@@ -210,6 +212,12 @@ else ()
message (STATUS "Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)")
endif ()
+if (FLTK_BUILD_FLUID)
+ message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid")
+ else ()
+ message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)")
+ endif ()
+
if (FLTK_BUILD_TEST)
message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test")
endif ()
diff --git a/README.CMake.txt b/README.CMake.txt
index c26af1fe6..e83dc49a4 100644
--- a/README.CMake.txt
+++ b/README.CMake.txt
@@ -119,6 +119,9 @@ OPTION_BUILD_SHARED_LIBS - default OFF
Normally FLTK is built as static libraries which makes more portable
binaries. If you want to use shared libraries, this will build them too.
+FLTK_BUILD_FLUID - default ON
+ Builds the Fast Light User-Interface Designer ("FLUID").
+
FLTK_BUILD_TEST - default ON
Builds the test and demo programs in the 'test' directory.