2014-02-09 22:41:29 +04:00
|
|
|
#
|
2014-11-22 03:42:44 +03:00
|
|
|
# "$Id$"
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
|
|
|
# Written by Michael Surette
|
|
|
|
#
|
2015-02-16 17:30:27 +03:00
|
|
|
# Copyright 1998-2015 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:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/COPYING.php
|
|
|
|
#
|
|
|
|
# Please report all bugs and problems on the following page:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/str.php
|
|
|
|
#
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# final config and export
|
|
|
|
#######################################################################
|
|
|
|
# Set the fluid executable path
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
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})
|
2014-09-27 04:41:06 +04:00
|
|
|
set(FLUID) # no export
|
2014-02-09 22:41:29 +04:00
|
|
|
set_target_properties(fluid
|
|
|
|
PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_subdirectory(fluid)
|
|
|
|
set(FLTK_FLUID_EXECUTABLE fluid)
|
2014-09-27 04:41:06 +04:00
|
|
|
set(FLUID fluid) # export
|
2014-02-09 22:41:29 +04:00
|
|
|
endif(CMAKE_CROSSCOMPILING)
|
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
# generate FLTK-Targets.cmake for build directory use
|
|
|
|
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_BINARY_DIR}/FLTK-Targets.cmake)
|
|
|
|
|
|
|
|
# generate FLTKConfig.cmake for build directory use
|
2014-11-24 12:35:04 +03:00
|
|
|
set(INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
|
|
|
|
set(CONFIG_PATH ${FLTK_BINARY_DIR})
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
configure_file(
|
|
|
|
${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
2014-09-27 04:41:06 +04:00
|
|
|
${FLTK_BINARY_DIR}/FLTKConfig.cmake
|
2014-02-09 22:41:29 +04:00
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
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(
|
|
|
|
${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
2014-09-27 04:41:06 +04:00
|
|
|
${FLTK_BINARY_DIR}/UseFLTK.cmake
|
2014-02-09 22:41:29 +04:00
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2015-04-25 16:50:27 +03:00
|
|
|
# generate fltk-config for build directory use
|
|
|
|
set(prefix ${FLTK_BINARY_DIR})
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(includedir "${FLTK_SOURCE_DIR}")
|
2015-07-13 01:32:30 +03:00
|
|
|
set(BINARY_DIR "${FLTK_BINARY_DIR}")
|
2015-04-25 16:50:27 +03:00
|
|
|
set(libdir "\${exec_prefix}/lib")
|
|
|
|
set(srcdir ".")
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2015-04-25 16:50:27 +03:00
|
|
|
set(LIBNAME "${libdir}/libfltk.a")
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
configure_file(
|
2015-04-25 16:50:27 +03:00
|
|
|
"${FLTK_SOURCE_DIR}/fltk-config.in"
|
2014-02-09 22:41:29 +04:00
|
|
|
"${FLTK_BINARY_DIR}/fltk-config"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
if(UNIX)
|
|
|
|
execute_process(COMMAND chmod 755 fltk-config
|
|
|
|
WORKING_DIRECTORY "${FLTK_BINARY_DIR}"
|
|
|
|
)
|
|
|
|
endif(UNIX)
|
|
|
|
|
2015-12-31 00:13:07 +03:00
|
|
|
# prepare some variables for config.h
|
|
|
|
|
|
|
|
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}")
|
|
|
|
|
|
|
|
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}")
|
|
|
|
|
|
|
|
set(CONFIG_H_IN configh.cmake.in)
|
|
|
|
set(CONFIG_H config.h)
|
|
|
|
|
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(
|
2015-12-31 00:13:07 +03:00
|
|
|
"${FLTK_SOURCE_DIR}/${CONFIG_H_IN}"
|
|
|
|
"${FLTK_BINARY_DIR}/${CONFIG_H}"
|
2015-04-25 16:50:27 +03:00
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
if(OPTION_CREATE_LINKS)
|
2015-02-16 17:30:27 +03:00
|
|
|
# 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})
|
2014-02-09 22:41:29 +04:00
|
|
|
configure_file(
|
|
|
|
"${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
|
|
|
|
"${FLTK_BINARY_DIR}/install-symlinks.cmake"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
endif(OPTION_CREATE_LINKS)
|