2014-02-09 22:41:29 +04:00
|
|
|
#
|
2021-11-12 01:11:06 +03:00
|
|
|
# Export CMake file to build the FLTK project using CMake (www.cmake.org)
|
2022-04-02 23:08:50 +03:00
|
|
|
# Originally written by Michael Surette
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2022-04-02 23:08:50 +03:00
|
|
|
# Copyright 1998-2022 by Bill Spitzak and others.
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# file is missing or damaged, see the license at:
|
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/bugs.php
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# final config and export
|
|
|
|
#######################################################################
|
2020-06-13 16:19:27 +03:00
|
|
|
|
2021-11-12 01:11:06 +03:00
|
|
|
# Set the fluid executable path used to create .cxx/.h from .fl files
|
|
|
|
|
2022-11-13 22:16:54 +03:00
|
|
|
if (FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
|
2021-11-12 01:11:06 +03:00
|
|
|
# use the fluid executable we build
|
2022-04-02 23:08:50 +03:00
|
|
|
if (WIN32)
|
|
|
|
set (FLTK_FLUID_EXECUTABLE fluid-cmd)
|
|
|
|
set (FLUID_EXPORT fluid fluid-cmd) # export fluid and fluid-cmd
|
|
|
|
else ()
|
|
|
|
set (FLTK_FLUID_EXECUTABLE fluid)
|
|
|
|
set (FLUID_EXPORT fluid) # export fluid
|
|
|
|
endif ()
|
2022-11-13 22:16:54 +03:00
|
|
|
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)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
# generate FLTK-Targets.cmake for build directory use
|
2022-04-02 23:08:50 +03:00
|
|
|
export (TARGETS ${FLUID_EXPORT} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# generate FLTK-Functions.cmake for build directory use
|
|
|
|
configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTK-Functions.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/FLTK-Functions.cmake
|
|
|
|
COPYONLY
|
|
|
|
)
|
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
# generate FLTKConfig.cmake for build directory use
|
2020-06-13 16:19:27 +03:00
|
|
|
set (INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
|
2021-12-20 21:18:38 +03:00
|
|
|
if (FLTK_HAVE_CAIRO)
|
|
|
|
list (APPEND INCLUDE_DIRS ${PKG_CAIRO_INCLUDE_DIRS})
|
|
|
|
endif ()
|
2020-06-13 16:19:27 +03:00
|
|
|
set (CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
configure_file(
|
2020-06-13 16:19:27 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/FLTKConfig.cmake
|
|
|
|
@ONLY
|
2014-02-09 22:41:29 +04:00
|
|
|
)
|
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
# generate UseFLTK.cmake for build directory use
|
2014-02-09 22:41:29 +04:00
|
|
|
configure_file(
|
2020-06-13 16:19:27 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/UseFLTK.cmake
|
|
|
|
@ONLY
|
2014-02-09 22:41:29 +04:00
|
|
|
)
|
|
|
|
|
2015-04-25 16:50:27 +03:00
|
|
|
# generate fltk-config for build directory use
|
2020-06-13 16:19:27 +03:00
|
|
|
set (prefix ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
set (exec_prefix "\${prefix}")
|
|
|
|
set (includedir "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
set (BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
set (libdir "\${exec_prefix}/lib")
|
|
|
|
set (srcdir ".")
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (LIBNAME "${libdir}/libfltk.a")
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
configure_file(
|
2020-06-13 16:19:27 +03:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/fltk-config.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/fltk-config"
|
|
|
|
@ONLY
|
2014-02-09 22:41:29 +04:00
|
|
|
)
|
2018-02-23 22:41:52 +03:00
|
|
|
|
2022-03-13 23:52:18 +03:00
|
|
|
# Set execute permissions on fltk-config in build dir
|
|
|
|
# Note: file(CHMOD) available since CMake 3.19,
|
|
|
|
# use fallback before CMake 3.19
|
|
|
|
|
|
|
|
if (CMAKE_VERSION VERSION_LESS 3.19)
|
|
|
|
if (UNIX OR MSYS OR MINGW)
|
|
|
|
execute_process(COMMAND chmod 755 fltk-config
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
endif ()
|
|
|
|
else (CMAKE_VERSION VERSION_LESS 3.19)
|
|
|
|
file (CHMOD "${CMAKE_CURRENT_BINARY_DIR}/fltk-config"
|
|
|
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
|
|
|
GROUP_READ GROUP_EXECUTE
|
|
|
|
WORLD_READ WORLD_EXECUTE)
|
|
|
|
endif (CMAKE_VERSION VERSION_LESS 3.19)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2015-12-31 00:13:07 +03:00
|
|
|
# prepare some variables for config.h
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
if (IS_ABSOLUTE "${FLTK_DATADIR}")
|
|
|
|
set (PREFIX_DATA "${FLTK_DATADIR}/fltk")
|
|
|
|
else (IS_ABSOLUTE "${FLTK_DATADIR}")
|
|
|
|
set (PREFIX_DATA "${CMAKE_INSTALL_PREFIX}/${FLTK_DATADIR}/fltk")
|
|
|
|
endif (IS_ABSOLUTE "${FLTK_DATADIR}")
|
2015-12-31 00:13:07 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
if (IS_ABSOLUTE "${FLTK_DOCDIR}")
|
|
|
|
set (PREFIX_DOC "${FLTK_DOCDIR}/fltk")
|
|
|
|
else (IS_ABSOLUTE "${FLTK_DOCDIR}")
|
|
|
|
set (PREFIX_DOC "${CMAKE_INSTALL_PREFIX}/${FLTK_DOCDIR}/fltk")
|
|
|
|
endif (IS_ABSOLUTE "${FLTK_DOCDIR}")
|
2015-12-31 00:13:07 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (CONFIG_H_IN configh.cmake.in)
|
|
|
|
set (CONFIG_H config.h)
|
2015-12-31 00:13:07 +03:00
|
|
|
|
2015-04-25 16:50:27 +03:00
|
|
|
# generate config.h
|
2015-12-31 00:13:07 +03:00
|
|
|
|
2015-04-25 16:50:27 +03:00
|
|
|
configure_file(
|
2020-06-13 16:19:27 +03:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${CONFIG_H_IN}"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_H}"
|
|
|
|
@ONLY
|
2015-04-25 16:50:27 +03:00
|
|
|
)
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
if (OPTION_CREATE_LINKS)
|
|
|
|
# Set PREFIX_INCLUDE to the proper value.
|
|
|
|
if (IS_ABSOLUTE ${FLTK_INCLUDEDIR})
|
|
|
|
set (PREFIX_INCLUDE ${FLTK_INCLUDEDIR})
|
|
|
|
else ()
|
|
|
|
set (PREFIX_INCLUDE "${CMAKE_INSTALL_PREFIX}/${FLTK_INCLUDEDIR}")
|
|
|
|
endif (IS_ABSOLUTE ${FLTK_INCLUDEDIR})
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake"
|
2022-03-13 23:52:18 +03:00
|
|
|
@ONLY)
|
2020-06-13 16:19:27 +03:00
|
|
|
endif (OPTION_CREATE_LINKS)
|