From 654e20ff8b8ee8d8679acad5e448d0e16c9afb42 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 11 Nov 2021 23:11:06 +0100 Subject: CMake: Build fluid when cross-compiling --- CMake/FLTK-Functions.cmake | 2 +- CMake/export.cmake | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'CMake') 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) -- cgit v1.2.3