summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-11-11 23:11:06 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-11-11 23:11:06 +0100
commit654e20ff8b8ee8d8679acad5e448d0e16c9afb42 (patch)
tree59a212dd7c1d3db3eb8157292215f42ffc4caa0c /CMake
parent6d1f5608ba155e57e7f9efb7925de634e59e7369 (diff)
CMake: Build fluid when cross-compiling
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FLTK-Functions.cmake2
-rw-r--r--CMake/export.cmake20
2 files changed, 9 insertions, 13 deletions
diff --git a/CMake/FLTK-Functions.cmake b/CMake/FLTK-Functions.cmake
index 2c29efe73..460f89fbf 100644
--- a/CMake/FLTK-Functions.cmake
+++ b/CMake/FLTK-Functions.cmake
@@ -28,7 +28,7 @@ function (FLTK_RUN_FLUID TARGET SOURCES)
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
add_custom_command(
OUTPUT "${basename}.cxx" "${basename}.h"
- COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+ COMMAND ${FLTK_FLUID_EXECUTABLE} -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
DEPENDS ${src}
MAIN_DEPENDENCY ${src}
)
diff --git a/CMake/export.cmake b/CMake/export.cmake
index 6e8bc5dd6..81f6e08d1 100644
--- a/CMake/export.cmake
+++ b/CMake/export.cmake
@@ -1,8 +1,8 @@
#
-# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
+# Export CMake file to build the FLTK project using CMake (www.cmake.org)
# Written by Michael Surette
#
-# Copyright 1998-2020 by Bill Spitzak and others.
+# Copyright 1998-2021 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@@ -19,27 +19,23 @@
# final config and export
#######################################################################
-# Set the fluid executable path
+# 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
)
- add_executable(fluid IMPORTED)
set (FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
- set (FLUID) # no export
- set_target_properties(fluid
- PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
- )
+ set (FLUID) # don't export
else ()
- add_subdirectory(fluid)
+ # use the fluid executable we build
set (FLTK_FLUID_EXECUTABLE fluid)
- set (FLUID fluid) # export
+ set (FLUID fluid) # export
endif (CMAKE_CROSSCOMPILING)
-add_subdirectory(src)
-
# generate FLTK-Targets.cmake for build directory use
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)