Hash :
8763fa4e
Author :
Date :
2019-10-28T13:44:16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(FTGL)
SET(CMAKE_MODULE_PATH ${FTGL_SOURCE_DIR})
SET(VERSION_SERIES 2)
SET(VERSION_MAJOR 4)
SET(VERSION_MINOR 0)
SET(FTGL_SOVERSION 1)
FIND_PACKAGE(Freetype REQUIRED) # if it fails, check this: https://bugs.launchpad.net/ubuntu/+source/cmake/+bug/826988
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/FTFont)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/FTGL)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/FTGlyph)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/FTLayout)
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Allow the developer to select if Dynamic or Static libraries are built
OPTION(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
IF(BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
ADD_DEFINITIONS(-DFTGL_LIBRARY)
ELSE(BUILD_SHARED_LIBS)
SET(LIB_TYPE STATIC)
ADD_DEFINITIONS(-D FTGL_LIBRARY_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ADD_CUSTOM_TARGET(doc)
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(doxygen
${DOXYGEN_EXECUTABLE}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Doxygen ...")
ADD_DEPENDENCIES(doc doxygen)
ENDIF(DOXYGEN_FOUND)
SUBDIRS(src)
FIND_PACKAGE(CxxTest)
IF(CxxTest_FOUND)
OPTION(BUILD_TESTS "Build Unit Tests" ON)
IF(BUILD_TESTS)
SUBDIRS(test)
ENDIF(BUILD_TESTS)
ENDIF(CxxTest_FOUND)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/FTGLConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/FTGLConfig.cmake"
@ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/FTGLConfig-install.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FTGLConfig.cmake"
@ONLY)
if (WIN32)
set(cmakedir cmake)
else ()
set(cmakedir lib/cmake/FTGL)
endif ()
install(EXPORT FTGL-targets DESTINATION "${cmakedir}")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FTGLConfig.cmake"
DESTINATION "${cmakedir}")
SET(PKGCONFIG_INSTALL_PREFIX "lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/ftgl.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
@ONLY)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
DESTINATION ${PKGCONFIG_INSTALL_PREFIX})