2004-10-19 00:29:58 +04:00
|
|
|
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
|
|
|
# Written by Andy Cedilnik and Julien Jomier
|
|
|
|
|
|
|
|
PROJECT(FLTK)
|
2005-02-06 03:17:50 +03:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
# The FLTK version
|
|
|
|
SET(FLTK_VERSION_MAJOR "1")
|
|
|
|
SET(FLTK_VERSION_MINOR "1")
|
|
|
|
SET(FLTK_VERSION_PATCH "5")
|
|
|
|
SET(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
|
|
|
|
SET(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
|
|
|
|
|
|
|
|
# Executables and libraries should just go to bin
|
|
|
|
SET(EXECUTABLE_OUTPUT_PATH "${FLTK_BINARY_DIR}/bin" CACHE INTERNAL
|
2004-10-19 00:29:58 +04:00
|
|
|
"Where to put the executables for FLTK"
|
|
|
|
)
|
2005-02-06 03:17:50 +03:00
|
|
|
SET(LIBRARY_OUTPUT_PATH "${FLTK_BINARY_DIR}/bin" CACHE INTERNAL
|
2004-10-19 00:29:58 +04:00
|
|
|
"Where to put the libraries for FLTK"
|
|
|
|
)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
# Allow building shared libraries
|
|
|
|
OPTION(BUILD_SHARED_LIBS "Build FLTK as a shared library" OFF)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
# Search for modules in the FLTK source dir first
|
|
|
|
SET(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Test for some required system information.
|
|
|
|
FIND_PACKAGE(Threads)
|
|
|
|
SET (CMAKE_USE_PTHREADS
|
|
|
|
"${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL "Use the pthreads library.")
|
|
|
|
|
|
|
|
# We need ansi c-flags, especially on HP
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
|
|
|
|
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS})
|
|
|
|
|
2004-10-19 00:29:58 +04:00
|
|
|
IF(WIN32)
|
|
|
|
IF(NOT CYGWIN)
|
|
|
|
IF(BORLAND)
|
|
|
|
SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
|
|
|
|
ELSE(BORLAND)
|
|
|
|
SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
|
|
|
|
ENDIF(BORLAND)
|
|
|
|
ENDIF(NOT CYGWIN)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
SET(FLTK_X11 1)
|
|
|
|
SET(FLTK_APPLE 0)
|
|
|
|
IF(APPLE)
|
|
|
|
OPTION(FLTK_APPLE_X11 "Use X11 on Mac instead of Carbon" OFF)
|
|
|
|
MARK_AS_ADVANCED(FLTK_APPLE_X11)
|
|
|
|
IF(NOT FLTK_APPLE_X11)
|
|
|
|
SET(FLTK_APPLE 1)
|
|
|
|
SET(FLTK_X11 0)
|
|
|
|
OPTION(FLTK_QUARTZ "Use Quartz instead of Quickdraw" OFF)
|
|
|
|
ENDIF(NOT FLTK_APPLE_X11)
|
|
|
|
ENDIF(APPLE)
|
|
|
|
|
|
|
|
IF(UNIX)
|
2005-02-06 03:17:50 +03:00
|
|
|
FIND_PACKAGE(X11)
|
2004-10-19 00:29:58 +04:00
|
|
|
SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
|
|
|
|
ENDIF(UNIX)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
IF(APPLE AND NOT FLTK_APPLE_X11)
|
|
|
|
SET( FLTK_PLATFORM_DEPENDENT_LIBS
|
|
|
|
"-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
|
|
|
|
ENDIF(APPLE AND NOT FLTK_APPLE_X11)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
|
|
|
IF(CYGWIN)
|
|
|
|
ADD_DEFINITIONS(-DWIN32)
|
|
|
|
SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
|
|
|
|
ENDIF(CYGWIN)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
INCLUDE(CheckIncludeFiles)
|
2004-10-19 00:29:58 +04:00
|
|
|
# Check if header file exists and add it to the list.
|
|
|
|
MACRO(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
|
|
|
|
CHECK_INCLUDE_FILES("${PROJECT_INCLUDES};${FILE}" ${VARIABLE})
|
|
|
|
IF(${VARIABLE})
|
|
|
|
SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${FILE})
|
|
|
|
ENDIF(${VARIABLE})
|
|
|
|
ENDMACRO(CHECK_INCLUDE_FILE_CONCAT)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("GL/glu.h" HAVE_GL_GLU_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("OpenGL/glu.h" HAVE_OPENGL_GLU_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("dirent.h" HAVE_DIRENT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("stdio.h" HAVE_STDIO_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("strings.h" HAVE_STRINGS_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("sys/dir.h" HAVE_SYS_DIR_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("sys/ndir.h" HAVE_SYS_NDIR_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("sys/select.h" HAVE_SYS_SELECT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CONCAT("sys/stdtypes.h" HAVE_SYS_STDTYPES_H)
|
|
|
|
CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
FIND_PACKAGE(ZLIB)
|
|
|
|
FIND_PACKAGE(PNG)
|
|
|
|
FIND_PACKAGE(JPEG)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
INCLUDE(CheckSymbolExists)
|
|
|
|
INCLUDE(CheckFunctionWithHeaderExists)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
|
|
|
CHECK_FUNCTIONWITHHEADER_EXISTS("int strcasecmp()" "${PROJECT_INCLUDES}" HAVE_STRCASECMP)
|
|
|
|
|
|
|
|
CHECK_SYMBOL_EXISTS(strlcat "${PROJECT_INCLUDES}" HAVE_STRLCAT)
|
|
|
|
CHECK_SYMBOL_EXISTS(strlcpy "${PROJECT_INCLUDES}" HAVE_STRLCPY)
|
|
|
|
CHECK_SYMBOL_EXISTS(vsnprintf "${PROJECT_INCLUDES}" HAVE_VSNPRINTF)
|
|
|
|
CHECK_SYMBOL_EXISTS(snprintf "${PROJECT_INCLUDES}" HAVE_SNPRINTF)
|
|
|
|
CHECK_SYMBOL_EXISTS(scandir "${PROJECT_INCLUDES}" HAVE_SCANDIR)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
INCLUDE(CheckTypeSize)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
|
|
|
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
|
|
|
|
CHECK_TYPE_SIZE(int SIZEOF_INT)
|
|
|
|
CHECK_TYPE_SIZE(long SIZEOF_LONG)
|
|
|
|
|
|
|
|
IF(${SIZEOF_SHORT} MATCHES "^2$")
|
|
|
|
SET(U16 "unsigned short")
|
|
|
|
ENDIF(${SIZEOF_SHORT} MATCHES "^2$")
|
|
|
|
|
|
|
|
IF(${SIZEOF_INT} MATCHES "^4$")
|
|
|
|
SET(U32 "unsigned")
|
|
|
|
ELSE(${SIZEOF_INT} MATCHES "^4$")
|
|
|
|
IF(${SIZEOF_LONG} MATCHES "^4$")
|
|
|
|
SET(U32 "unsigned long")
|
|
|
|
ENDIF(${SIZEOF_LONG} MATCHES "^4$")
|
|
|
|
ENDIF(${SIZEOF_INT} MATCHES "^4$")
|
|
|
|
|
|
|
|
IF(${SIZEOF_INT} MATCHES "^8$")
|
|
|
|
SET(U64 "unsigned")
|
|
|
|
ELSE(${SIZEOF_INT} MATCHES "^8$")
|
|
|
|
IF(${SIZEOF_LONG} MATCHES "^8$")
|
|
|
|
SET(U64 "unsigned long")
|
|
|
|
ENDIF(${SIZEOF_LONG} MATCHES "^8$")
|
|
|
|
ENDIF(${SIZEOF_INT} MATCHES "^8$")
|
|
|
|
|
|
|
|
# Set an option to build FLTK with OpenGL support
|
2005-02-06 03:17:50 +03:00
|
|
|
SET(HAVE_GL 0)
|
2004-10-19 00:29:58 +04:00
|
|
|
OPTION(USE_OPENGL "OpenGL Support" ON)
|
|
|
|
IF(USE_OPENGL)
|
2005-02-06 03:17:50 +03:00
|
|
|
FIND_PACKAGE(OpenGL)
|
2004-10-19 00:29:58 +04:00
|
|
|
IF(OPENGL_FOUND)
|
|
|
|
SET(HAVE_GL 1)
|
2005-02-06 03:17:50 +03:00
|
|
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
2004-10-19 00:29:58 +04:00
|
|
|
ENDIF(OPENGL_FOUND)
|
|
|
|
ENDIF(USE_OPENGL)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Perform the FLTK specific test with status output
|
|
|
|
#
|
|
|
|
MACRO(PERFORM_CMAKE_TEST FILE TEST)
|
|
|
|
IF("${TEST}" MATCHES "^${TEST}$")
|
|
|
|
# Perform test
|
|
|
|
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
|
|
|
"-D${TEST} ${CMAKE_REQUIRED_FLAGS}")
|
|
|
|
IF(CMAKE_REQUIRED_LIBRARIES)
|
|
|
|
SET(TEST_ADD_LIBRARIES
|
|
|
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
|
|
|
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
|
|
|
MESSAGE(STATUS "Performing Test ${TEST}")
|
|
|
|
|
|
|
|
TRY_COMPILE(${TEST}
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
|
|
|
|
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
|
|
|
-DLINK_LIBRARIES:STRING=${CMAKE_TEST_SPECIAL_LIBRARIES}
|
|
|
|
"${TEST_ADD_LIBRARIES}"
|
|
|
|
OUTPUT_VARIABLE OUTPUT)
|
|
|
|
IF(${TEST})
|
|
|
|
SET(${TEST} 1 CACHE INTERNAL "CMake test ${FUNCTION}")
|
|
|
|
MESSAGE(STATUS "Performing Test ${TEST} - Success")
|
|
|
|
ELSE(${TEST})
|
|
|
|
MESSAGE(STATUS "Performing Test ${TEST} - Failed")
|
|
|
|
SET(${TEST} 0 CACHE INTERNAL "Test ${FUNCTION}")
|
|
|
|
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
|
|
|
|
"Performing Test ${TEST} failed with the following output:\n"
|
|
|
|
"${OUTPUT}\n" APPEND)
|
|
|
|
ENDIF(${TEST})
|
|
|
|
ENDIF("${TEST}" MATCHES "^${TEST}$")
|
|
|
|
ENDMACRO(PERFORM_CMAKE_TEST FILE TEST)
|
|
|
|
|
|
|
|
# Set an option to build the zlib library or not
|
2005-02-06 03:17:50 +03:00
|
|
|
OPTION(FLTK_USE_SYSTEM_ZLIB "Use's system zlib" OFF)
|
2004-10-19 00:29:58 +04:00
|
|
|
IF(FLTK_USE_SYSTEM_ZLIB)
|
|
|
|
IF(ZLIB_FOUND)
|
|
|
|
SET(CMAKE_TEST_SPECIAL_LIBRARIES ${ZLIB_LIBRARIES})
|
|
|
|
PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBZ)
|
|
|
|
ENDIF(ZLIB_FOUND)
|
|
|
|
# We build the fltk zlib
|
|
|
|
ELSE(FLTK_USE_SYSTEM_ZLIB)
|
|
|
|
MARK_AS_ADVANCED(ZLIB_INCLUDE_DIR)
|
|
|
|
MARK_AS_ADVANCED(ZLIB_LIBRARY)
|
|
|
|
SUBDIRS(zlib)
|
2005-02-24 23:26:22 +03:00
|
|
|
SET(HAVE_LIBZ 1)
|
|
|
|
SET(FLTK_ZLIB_LIBRARIES fltk_zlib)
|
|
|
|
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/zlib")
|
2004-10-19 00:29:58 +04:00
|
|
|
ENDIF(FLTK_USE_SYSTEM_ZLIB)
|
|
|
|
|
|
|
|
# Set an option to build the jpeg library or not
|
2005-02-06 03:17:50 +03:00
|
|
|
OPTION(FLTK_USE_SYSTEM_JPEG "Use's system jpeg" OFF)
|
2004-10-19 00:29:58 +04:00
|
|
|
IF(FLTK_USE_SYSTEM_JPEG)
|
|
|
|
IF(JPEG_FOUND)
|
|
|
|
SET(CMAKE_TEST_SPECIAL_LIBRARIES ${JPEG_LIBRARIES})
|
|
|
|
PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBJPEG)
|
|
|
|
ENDIF(JPEG_FOUND)
|
|
|
|
# We build the fltk png
|
|
|
|
ELSE(FLTK_USE_SYSTEM_JPEG)
|
|
|
|
MARK_AS_ADVANCED(JPEG_INCLUDE_DIR)
|
|
|
|
MARK_AS_ADVANCED(JPEG_LIBRARY)
|
|
|
|
SUBDIRS(jpeg)
|
2005-02-24 23:26:22 +03:00
|
|
|
SET(HAVE_LIBJPEG 1)
|
|
|
|
SET(JPEG_LIBRARIES fltk_jpeg)
|
|
|
|
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/jpeg")
|
2004-10-19 00:29:58 +04:00
|
|
|
ENDIF(FLTK_USE_SYSTEM_JPEG)
|
|
|
|
|
|
|
|
# Set an option to build the png library or not
|
2005-02-06 03:17:50 +03:00
|
|
|
OPTION(FLTK_USE_SYSTEM_PNG "Use's system png" OFF)
|
2004-10-19 00:29:58 +04:00
|
|
|
IF(FLTK_USE_SYSTEM_PNG)
|
|
|
|
IF(PNG_FOUND)
|
|
|
|
SET(CMAKE_TEST_SPECIAL_LIBRARIES ${PNG_LIBRARIES})
|
|
|
|
PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBPNG)
|
|
|
|
PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_PNG_GET_VALID)
|
|
|
|
PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_PNG_SET_TRNS_TO_ALPHA)
|
|
|
|
SET(HAVE_PNG_H 1)
|
|
|
|
ENDIF(PNG_FOUND)
|
|
|
|
# We build the fltk png
|
|
|
|
ELSE(FLTK_USE_SYSTEM_PNG)
|
|
|
|
MARK_AS_ADVANCED(PNG_INCLUDE_DIR)
|
|
|
|
MARK_AS_ADVANCED(PNG_LIBRARY)
|
|
|
|
SUBDIRS(png)
|
2005-02-24 23:26:22 +03:00
|
|
|
SET(HAVE_LIBPNG 1)
|
|
|
|
SET(PNG_LIBRARIES fltk_png)
|
|
|
|
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/png")
|
2004-10-19 00:29:58 +04:00
|
|
|
ENDIF(FLTK_USE_SYSTEM_PNG)
|
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
SET(FLTK_DATADIR "${CMAKE_INSTALL_PREFIX}/share/FLTK")
|
|
|
|
SET(FLTK_DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/FLTK")
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
# Write out configuration header file
|
|
|
|
CONFIGURE_FILE(${FLTK_SOURCE_DIR}/configh.cmake.in
|
|
|
|
${FLTK_BINARY_DIR}/config.h)
|
|
|
|
|
|
|
|
# On unix create symlinks for backward compatibility
|
2004-10-19 00:29:58 +04:00
|
|
|
SET(FLTK_CREATE_SYMLINKS 1)
|
|
|
|
IF(WIN32)
|
|
|
|
IF(NOT UNIX)
|
|
|
|
SET(FLTK_CREATE_SYMLINKS 0)
|
|
|
|
ENDIF(NOT UNIX)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
MACRO(SAFE_CREATE_SYMLINK SOURCE DESTINATION)
|
|
|
|
IF(EXISTS "${DESTINATION}")
|
|
|
|
ELSE(EXISTS "${DESTINATION}")
|
2005-02-06 03:17:50 +03:00
|
|
|
MESSAGE(STATUS "Create symlink from: \"${SOURCE}\" to \"${DESTINATION}\"")
|
|
|
|
# The quoting here does seems unnatural, but this is to prevent bug in CMake
|
|
|
|
EXEC_PROGRAM(ln ARGS
|
|
|
|
"-s \"${SOURCE}\" \"${DESTINATION}\"" OUTPUT_VARIABLE ln_output
|
2004-10-19 00:29:58 +04:00
|
|
|
RETURN_VALUE ln_retval)
|
|
|
|
IF("${ln_retval}" GREATER 0)
|
|
|
|
MESSAGE(FATAL_ERROR "Problem creatin symlink from \"${SOURCE}\" to \"${DESTINATION}\":\n${ln_output}")
|
|
|
|
ENDIF("${ln_retval}" GREATER 0)
|
|
|
|
ENDIF(EXISTS "${DESTINATION}")
|
|
|
|
ENDMACRO(SAFE_CREATE_SYMLINK SOURCE DESTINATION)
|
|
|
|
|
|
|
|
# If this is out-of-source build, then copy FL directory
|
2005-02-06 03:17:50 +03:00
|
|
|
FILE(GLOB FLTK_HEADER_FILES "${FLTK_SOURCE_DIR}/FL/*.[hHr]")
|
2004-10-19 00:29:58 +04:00
|
|
|
FOREACH(file ${FLTK_HEADER_FILES})
|
|
|
|
GET_FILENAME_COMPONENT(ext "${file}" EXT)
|
|
|
|
GET_FILENAME_COMPONENT(namewe "${file}" NAME_WE)
|
|
|
|
GET_FILENAME_COMPONENT(name "${file}" NAME)
|
|
|
|
STRING(COMPARE EQUAL "${ext}" ".h" lower_case_h)
|
|
|
|
STRING(COMPARE EQUAL "${ext}" ".H" upper_case_h)
|
|
|
|
IF(lower_case_h OR upper_case_h)
|
|
|
|
SET(outfile_h "${FLTK_BINARY_DIR}/FL/${namewe}.h")
|
|
|
|
SET(outfile_H "${FLTK_BINARY_DIR}/FL/${namewe}.H")
|
|
|
|
CONFIGURE_FILE("${file}" "${outfile_H}" COPYONLY IMMEDIATE)
|
2005-02-06 03:17:50 +03:00
|
|
|
CONFIGURE_FILE("${file}" "${outfile_h}" COPYONLY IMMEDIATE)
|
2004-10-19 00:29:58 +04:00
|
|
|
# IF(FLTK_CREATE_SYMLINKS)
|
|
|
|
# SAFE_CREATE_SYMLINK("${outfile_H}" "${outfile_h}")
|
|
|
|
# ENDIF(FLTK_CREATE_SYMLINKS)
|
|
|
|
ELSE(lower_case_h OR upper_case_h)
|
|
|
|
STRING(COMPARE EQUAL "${ext}" ".r" mac_resource_file)
|
|
|
|
IF(mac_resource_file)
|
|
|
|
SET(outfile "${FLTK_BINARY_DIR}/FL/${name}")
|
|
|
|
CONFIGURE_FILE("${file}" "${outfile}" COPYONLY IMMEDIATE)
|
|
|
|
ENDIF(mac_resource_file)
|
|
|
|
ENDIF(lower_case_h OR upper_case_h)
|
|
|
|
ENDFOREACH(file)
|
|
|
|
|
|
|
|
IF(FLTK_CREATE_SYMLINKS)
|
|
|
|
SAFE_CREATE_SYMLINK(
|
|
|
|
"${FLTK_BINARY_DIR}/FL"
|
|
|
|
"${FLTK_BINARY_DIR}/Fl")
|
|
|
|
|
|
|
|
SAFE_CREATE_SYMLINK(
|
|
|
|
"${FLTK_BINARY_DIR}/FL/gl.H"
|
|
|
|
"${FLTK_BINARY_DIR}/FL/gl.h")
|
|
|
|
|
|
|
|
# Create the symlinks
|
|
|
|
FILE(READ ${FLTK_SOURCE_DIR}/fltk.list.in SYMLINKSFILE)
|
|
|
|
STRING(REGEX MATCHALL "(l 0000 root sys .includedir/)([^(\n)])+"
|
|
|
|
SYMLINKS ${SYMLINKSFILE})
|
|
|
|
FOREACH(var ${SYMLINKS} )
|
|
|
|
IF("${var}" MATCHES ".H")
|
|
|
|
STRING(REGEX MATCH "(/F)([^(\n)])+" tmp ${var})
|
|
|
|
STRING(REGEX MATCH "(/F)([^( )])+" in ${tmp})
|
|
|
|
STRING(REGEX MATCH "( )([^(\n)])+" out ${tmp})
|
|
|
|
STRING(REGEX REPLACE "( )" "" out ${out})
|
|
|
|
SAFE_CREATE_SYMLINK("${FLTK_BINARY_DIR}/FL/${out}" "${FLTK_BINARY_DIR}/${in}")
|
|
|
|
ENDIF("${var}" MATCHES ".H")
|
|
|
|
ENDFOREACH(var)
|
|
|
|
ENDIF(FLTK_CREATE_SYMLINKS)
|
|
|
|
|
|
|
|
# Set the fluid executable path
|
2005-02-06 03:17:50 +03:00
|
|
|
UTILITY_SOURCE(FLUID_COMMAND fluid fluid fluid.cxx)
|
|
|
|
SET(FLUID_COMMAND "${FLUID_COMMAND}" CACHE INTERNAL "" FORCE)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
# Include header files in fltk binary tree
|
|
|
|
INCLUDE_DIRECTORIES(${FLTK_BINARY_DIR})
|
|
|
|
|
|
|
|
# Do the build of fltk libraries and fluid
|
|
|
|
SUBDIRS(src)
|
|
|
|
SUBDIRS(fluid)
|
|
|
|
|
|
|
|
|
|
|
|
# Set an option to build the examples and testing
|
|
|
|
OPTION(BUILD_EXAMPLES "Build the tests" ON)
|
|
|
|
IF(BUILD_EXAMPLES)
|
2004-10-19 00:29:58 +04:00
|
|
|
SUBDIRS(test)
|
2005-02-06 03:17:50 +03:00
|
|
|
ENDIF(BUILD_EXAMPLES)
|
|
|
|
|
|
|
|
OPTION(BUILD_TESTING "Build testing of FLTK" ON)
|
|
|
|
IF(BUILD_TESTING)
|
2004-10-19 00:29:58 +04:00
|
|
|
ENABLE_TESTING()
|
2005-02-06 03:17:50 +03:00
|
|
|
INCLUDE(Dart)
|
|
|
|
ENDIF(BUILD_TESTING)
|
2004-10-19 00:29:58 +04:00
|
|
|
|
2005-02-06 03:17:50 +03:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Help outside projects build FLTK projects.
|
|
|
|
INCLUDE(CMakeExportBuildSettings)
|
|
|
|
EXPORT_LIBRARY_DEPENDENCIES(${FLTK_BINARY_DIR}/FLTKLibraryDepends.cmake)
|
|
|
|
CMAKE_EXPORT_BUILD_SETTINGS(${FLTK_BINARY_DIR}/FLTKBuildSettings.cmake)
|
|
|
|
SET(FL_MAJOR_VERSION "${FLTK_VERSION_MAJOR}")
|
|
|
|
SET(FL_MINOR_VERSION "${FLTK_VERSION_MINOR}")
|
|
|
|
SET(FL_PATCH_VERSION "${FLTK_VERSION_PATCH}")
|
|
|
|
|
|
|
|
SET(CFLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
SET(CXXFLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
SET(CC "${CMAKE_C_COMPILER}")
|
|
|
|
SET(CXX "${CMAKE_CXX_COMPILER}")
|
|
|
|
|
|
|
|
# For build tree usage
|
|
|
|
SET(FLTK_FLUID_COMMAND "${FLUID_COMMAND}")
|
|
|
|
SET(FLTK_LIBRARY_DEPENDS_FILE ${FLTK_BINARY_DIR}/FLTKLibraryDepends.cmake)
|
2004-10-19 00:29:58 +04:00
|
|
|
SET(FLTK_EXECUTABLE_DIRS ${EXECUTABLE_OUTPUT_PATH})
|
|
|
|
SET(FLTK_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH})
|
2005-02-06 03:17:50 +03:00
|
|
|
SET(FLTK_USE_FILE ${FLTK_SOURCE_DIR}/CMake/FLTKUse.cmake)
|
|
|
|
SET(FLTK_INCLUDE_DIRS "${FLTK_BINARY_DIR}/FL")
|
|
|
|
SET(FLTK_BUILD_SETTINGS_FILE ${FLTK_BINARY_DIR}/FLTKBuildSettings.cmake)
|
|
|
|
SET(prefix "${FLTK_BINARY_DIR}")
|
|
|
|
SET(exec_prefix "${prefix}")
|
|
|
|
SET(exec_prefix_set "no")
|
|
|
|
SET(bindir "${prefix}/bin")
|
|
|
|
SET(includedir "${prefix}")
|
|
|
|
SET(libdir "${prefix}/bin")
|
|
|
|
SET(srcdir "${FLTK_SOURCE_DIR}")
|
|
|
|
|
|
|
|
CONFIGURE_FILE("${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in"
|
|
|
|
"${FLTK_BINARY_DIR}/FLTKConfig.cmake" @ONLY IMMEDIATE)
|
|
|
|
CONFIGURE_FILE("${FLTK_SOURCE_DIR}/fltk-config.in"
|
|
|
|
"${FLTK_BINARY_DIR}/fltk-config" @ONLY IMMEDIATE)
|
|
|
|
|
|
|
|
# For installed tree usage
|
|
|
|
SET(FLTK_FLUID_COMMAND "${CMAKE_INSTALL_PREFIX}/bin/fluid")
|
|
|
|
SET(FLTK_LIBRARY_DEPENDS_FILE ${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}/FLTKLibraryDepends.cmake)
|
|
|
|
SET(FLTK_EXECUTABLE_DIRS "${CMAKE_INSTALL_PREFIX}/bin")
|
|
|
|
SET(FLTK_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib")
|
|
|
|
SET(FLTK_USE_FILE "${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}/FLTKUse.cmake")
|
|
|
|
SET(FLTK_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/FL")
|
|
|
|
SET(FLTK_BUILD_SETTINGS_FILE ${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}/FLTKBuildSettings.cmake)
|
|
|
|
SET(prefix "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
SET(exec_prefix "${prefix}")
|
|
|
|
SET(exec_prefix_set "no")
|
|
|
|
SET(bindir "${prefix}/bin")
|
|
|
|
SET(includedir "${prefix}")
|
|
|
|
SET(libdir "${prefix}/lib")
|
|
|
|
SET(srcdir ".")
|
|
|
|
|
|
|
|
CONFIGURE_FILE("${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in"
|
|
|
|
"${FLTK_BINARY_DIR}/CMake/FLTKConfig.cmake" @ONLY IMMEDIATE)
|
|
|
|
CONFIGURE_FILE("${FLTK_SOURCE_DIR}/fltk-config.in"
|
|
|
|
"${FLTK_BINARY_DIR}/CMake/fltk-config" @ONLY IMMEDIATE)
|
|
|
|
|
|
|
|
INSTALL_FILES(/include/FL FILES ${FLTK_HEADER_FILES})
|
|
|
|
INSTALL_FILES(/lib/FLTK-${FLTK_VERSION} FILES "${FLTK_SOURCE_DIR}/CMake/FLTKUse.cmake")
|
|
|
|
INSTALL_FILES(/lib/FLTK-${FLTK_VERSION} FILES "${FLTK_BINARY_DIR}/FLTKBuildSettings.cmake")
|
|
|
|
INSTALL_FILES(/lib/FLTK-${FLTK_VERSION} FILES "${FLTK_BINARY_DIR}/FLTKLibraryDepends.cmake")
|
|
|
|
INSTALL_FILES(/lib/FLTK-${FLTK_VERSION} FILES "${FLTK_BINARY_DIR}/CMake/FLTKConfig.cmake")
|