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
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# basic setup
|
|
|
|
#######################################################################
|
|
|
|
# The FLTK version
|
|
|
|
set(FLTK_VERSION_MAJOR "1")
|
|
|
|
set(FLTK_VERSION_MINOR "3")
|
2015-03-10 04:41:55 +03:00
|
|
|
set(FLTK_VERSION_PATCH "4")
|
2014-02-09 22:41:29 +04:00
|
|
|
set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
|
|
|
|
set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
|
|
|
|
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin)
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
|
|
|
|
set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
|
|
|
|
|
|
|
|
# Search for modules in the FLTK source dir first
|
|
|
|
set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
|
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
set(FLTK_INCLUDE_DIRS ${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
|
|
|
|
include_directories(${FLTK_INCLUDE_DIRS})
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2015-02-16 17:30:27 +03:00
|
|
|
# Setup install locations
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER 2.8.4)
|
|
|
|
# Use GNUInstallDirs if available.
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
else()
|
|
|
|
# Else set reasonable defaults.
|
|
|
|
set(CMAKE_INSTALL_BINDIR bin)
|
|
|
|
set(CMAKE_INSTALL_LIBDIR lib)
|
|
|
|
set(CMAKE_INSTALL_INCLUDEDIR include)
|
|
|
|
set(CMAKE_INSTALL_DATADIR share)
|
|
|
|
set(CMAKE_INSTALL_MANDIR share/man)
|
|
|
|
endif(CMAKE_VERSION VERSION_GREATER 2.8.4)
|
|
|
|
|
|
|
|
set(FLTK_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH
|
|
|
|
"Binary install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
|
|
|
set(FLTK_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH
|
|
|
|
"Library install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
|
|
|
set(FLTK_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH
|
|
|
|
"Public header install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
|
|
|
set(FLTK_DATADIR ${CMAKE_INSTALL_DATADIR} CACHE PATH
|
|
|
|
"Non-arch data install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
|
|
|
set(FLTK_MANDIR ${CMAKE_INSTALL_MANDIR} CACHE PATH
|
|
|
|
"Manual install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
2015-12-31 00:13:07 +03:00
|
|
|
set(FLTK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc CACHE PATH
|
|
|
|
"Non-arch doc install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
2015-02-16 17:30:27 +03:00
|
|
|
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
# platform dependent information
|
|
|
|
#######################################################################
|
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
# fix no WIN32 defined issue
|
|
|
|
if(NOT WIN32)
|
|
|
|
if(_WIN32)
|
|
|
|
set(WIN32 _WIN32)
|
|
|
|
elseif(__WIN32__)
|
|
|
|
set(WIN32 __WIN32__)
|
|
|
|
endif(_WIN32)
|
|
|
|
endif(NOT WIN32)
|
|
|
|
|
2015-04-10 18:50:59 +03:00
|
|
|
# set where config files go
|
2014-09-27 04:41:06 +04:00
|
|
|
if(WIN32 AND NOT CYGWIN)
|
|
|
|
set(FLTK_CONFIG_PATH CMake)
|
|
|
|
elseif(APPLE)
|
|
|
|
set(FLTK_CONFIG_PATH FLTK/.framework/Resources/CMake)
|
|
|
|
else()
|
2015-04-07 18:18:35 +03:00
|
|
|
set(FLTK_CONFIG_PATH ${FLTK_DATADIR}/fltk)
|
2014-09-27 04:41:06 +04:00
|
|
|
endif(WIN32 AND NOT CYGWIN)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
include(TestBigEndian)
|
|
|
|
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
set(__APPLE_QUARTZ__ 1)
|
|
|
|
set(HAVE_STRCASECMP 1)
|
|
|
|
set(HAVE_DIRENT_H 1)
|
|
|
|
set(HAVE_SNPRINTF 1)
|
|
|
|
set(HAVE_VSNPRINTF 1)
|
|
|
|
set(HAVE_SCANDIR 1)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework Cocoa")
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
if(WIN32)
|
2014-09-27 04:41:06 +04:00
|
|
|
if(MSVC)
|
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
######## from ide/VisualC2010/config.h
|
|
|
|
set(BORDER_WIDTH 2)
|
|
|
|
########
|
|
|
|
endif(MSVC)
|
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL GNU)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows")
|
|
|
|
endif(CMAKE_C_COMPILER_ID STREQUAL GNU)
|
|
|
|
if(MINGW AND EXISTS /mingw)
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH /mingw)
|
|
|
|
endif(MINGW AND EXISTS /mingw)
|
2014-02-09 22:41:29 +04:00
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# size of ints
|
|
|
|
include(CheckTypeSize)
|
|
|
|
|
|
|
|
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
|
|
|
|
CHECK_TYPE_SIZE(int SIZEOF_INT)
|
|
|
|
CHECK_TYPE_SIZE(long SIZEOF_LONG)
|
|
|
|
CHECK_TYPE_SIZE("long long" HAVE_LONG_LONG)
|
|
|
|
|
|
|
|
if(${SIZEOF_SHORT} MATCHES "^2$")
|
|
|
|
set(U16 "unsigned short")
|
|
|
|
endif(${SIZEOF_SHORT} MATCHES "^2$")
|
|
|
|
|
|
|
|
if(${SIZEOF_INT} MATCHES "^4$")
|
|
|
|
set(U32 "unsigned")
|
|
|
|
else()
|
|
|
|
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()
|
|
|
|
if(${SIZEOF_LONG} MATCHES "^8$")
|
|
|
|
set(U64 "unsigned long")
|
|
|
|
endif(${SIZEOF_LONG} MATCHES "^8$")
|
|
|
|
endif(${SIZEOF_INT} MATCHES "^8$")
|