FLTK logo

[master] 654e20f - CMake: Build fluid when cross-compiling

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 654e20f - CMake: Build fluid when cross-compiling "Albrecht Schlosser" Nov 11, 2021  
 
commit 654e20ff8b8ee8d8679acad5e448d0e16c9afb42
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Thu Nov 11 23:11:06 2021 +0100
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Thu Nov 11 23:11:06 2021 +0100

    CMake: Build fluid when cross-compiling

 CMake/FLTK-Functions.cmake |  2 +-
 CMake/export.cmake         | 20 ++++++++------------
 CMakeLists.txt             | 14 ++++++++++++++
 fluid/CMakeLists.txt       |  4 ----
 4 files changed, 23 insertions(+), 17 deletions(-)

diff --git CMake/FLTK-Functions.cmake CMake/FLTK-Functions.cmake
index 2c29efe..460f89f 100644
--- CMake/FLTK-Functions.cmake
+++ 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 CMake/export.cmake CMake/export.cmake
index 6e8bc5d..81f6e08 100644
--- CMake/export.cmake
+++ 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)
 
diff --git CMakeLists.txt CMakeLists.txt
index 577e065..72b9102 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -115,6 +115,20 @@ endif (debug_build)
 unset (debug_build)
 
 #######################################################################
+# build the FLTK libraries
+#######################################################################
+
+add_subdirectory(src)
+
+#######################################################################
+# build fluid
+#######################################################################
+
+if (NOT ANDROID)
+  add_subdirectory(fluid)
+endif()
+
+#######################################################################
 # variables shared by export and install
 # export.cmake creates configuration files for direct use in a built but uninstalled FLTK
 # install.cmake creates these files for an installed FLTK
diff --git fluid/CMakeLists.txt fluid/CMakeLists.txt
index dce95ca..e791de6 100644
--- fluid/CMakeLists.txt
+++ fluid/CMakeLists.txt
@@ -14,8 +14,6 @@
 #     https://www.fltk.org/bugs.php
 #
 
-if (NOT ANDROID)
-
 set (CPPFILES
   CodeEditor.cxx
   StyleParse.cxx
@@ -115,5 +113,3 @@ if (UNIX)
     )
   endforeach()
 endif (UNIX)
-
-endif (NOT ANDROID)
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.