1# CMakeLists.txt 2# 3# Copyright (C) 2013-2020 by 4# David Turner, Robert Wilhelm, and Werner Lemberg. 5# 6# Written originally by John Cary <cary@txcorp.com> 7# 8# This file is part of the FreeType project, and may only be used, modified, 9# and distributed under the terms of the FreeType project license, 10# LICENSE.TXT. By continuing to use, modify, or distribute this file you 11# indicate that you have read the license and understand and accept it 12# fully. 13# 14# 15# The following will 1. create a build directory and 2. change into it and 16# call cmake to configure the build with default parameters as a static 17# library. See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html 18# for information about Debug, Release, etc. builds. 19# 20# cmake -B build -D CMAKE_BUILD_TYPE=Release 21# 22# For a dynamic library, use 23# 24# cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release 25# 26# For a framework on OS X, use 27# 28# cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true .. 29# 30# For an iOS static library, use 31# 32# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS .. 33# 34# or 35# 36# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR .. 37# 38# or 39# 40# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR64 .. 41# 42# Finally, build the project with: 43# 44# cmake --build build 45# 46# Install it with 47# 48# (sudo) cmake --build build --target install 49# 50# A binary distribution can be made with 51# 52# cmake --build build --config Release --target package 53# 54# Please refer to the cmake manual for further options, in particular, how 55# to modify compilation and linking parameters. 56# 57# Some notes. 58# 59# . `cmake' creates configuration files in 60# 61# <build-directory>/include/freetype/config 62# 63# which should be further modified if necessary. 64# 65# . You can use `cmake' directly on a freshly cloned FreeType git 66# repository. 67# 68# . `CMakeLists.txt' is provided as-is since it is normally not used by the 69# developer team. 70# 71# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG', 72# `FT_WITH_HARFBUZZ', and `FT_WITH_BROTLI' CMake variables to `ON' to 73# force using a dependency. Leave a variable undefined (which is the 74# default) to use the dependency only if it is available. Example: 75# 76# cmake -B build -D FT_WITH_ZLIB=ON \ 77# -D FT_WITH_BZIP2=ON \ 78# -D FT_WITH_PNG=ON \ 79# -D FT_WITH_HARFBUZZ=ON \ 80# -D FT_WITH_BROTLI=ON [...] 81# 82# Set `CMAKE_DISABLE_FIND_PACKAGE_XXX=TRUE' to disable a dependency completely 83# (where `XXX' is a CMake package name like `BZip2'). Example for disabling all 84# dependencies: 85# 86# cmake -B build -D CMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE \ 87# -D CMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE \ 88# -D CMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE \ 89# -D CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE \ 90# -D CMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE [...] 91# 92# . Installation of FreeType can be controlled with the CMake variables 93# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' 94# (this is compatible with the same CMake variables in zlib's CMake 95# support). 96 97# FreeType explicitly marks the API to be exported and relies on the compiler 98# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property 99# starting with 2.8.12. 100cmake_minimum_required(VERSION 2.8.12) 101 102if (NOT CMAKE_VERSION VERSION_LESS 3.3) 103 # Allow symbol visibility settings also on static libraries. CMake < 3.3 104 # only sets the property on a shared library build. 105 cmake_policy(SET CMP0063 NEW) 106endif () 107 108include(CheckIncludeFile) 109 110# CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which 111# configures the base build environment and references the toolchain file 112if (APPLE) 113 if (DEFINED IOS_PLATFORM) 114 if (NOT "${IOS_PLATFORM}" STREQUAL "OS" 115 AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR" 116 AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR64") 117 message(FATAL_ERROR 118 "IOS_PLATFORM must be set to either OS, SIMULATOR, or SIMULATOR64") 119 endif () 120 if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") 121 message(AUTHOR_WARNING 122 "You should use Xcode generator with IOS_PLATFORM enabled to get Universal builds.") 123 endif () 124 if (BUILD_SHARED_LIBS) 125 message(FATAL_ERROR 126 "BUILD_SHARED_LIBS can not be on with IOS_PLATFORM enabled") 127 endif () 128 if (BUILD_FRAMEWORK) 129 message(FATAL_ERROR 130 "BUILD_FRAMEWORK can not be on with IOS_PLATFORM enabled") 131 endif () 132 133 # iOS only uses static libraries 134 set(BUILD_SHARED_LIBS OFF) 135 136 set(CMAKE_TOOLCHAIN_FILE 137 ${CMAKE_SOURCE_DIR}/builds/cmake/iOS.cmake) 138 endif () 139else () 140 if (DEFINED IOS_PLATFORM) 141 message(FATAL_ERROR "IOS_PLATFORM is not supported on this platform") 142 endif () 143endif () 144 145 146project(freetype C) 147 148set(VERSION_MAJOR "2") 149set(VERSION_MINOR "10") 150set(VERSION_PATCH "4") 151 152# Generate LIBRARY_VERSION and LIBRARY_SOVERSION. 153set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") 154file(STRINGS "${PROJECT_SOURCE_DIR}/builds/unix/configure.raw" 155 VERSION_INFO 156 REGEX ${LIBTOOL_REGEX}) 157string(REGEX REPLACE 158 ${LIBTOOL_REGEX} "\\1" 159 LIBTOOL_CURRENT "${VERSION_INFO}") 160string(REGEX REPLACE 161 ${LIBTOOL_REGEX} "\\2" 162 LIBTOOL_REVISION "${VERSION_INFO}") 163string(REGEX REPLACE 164 ${LIBTOOL_REGEX} "\\3" 165 LIBTOOL_AGE "${VERSION_INFO}") 166 167# This is what libtool does internally on Unix platforms. 168math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}") 169set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}") 170 171# External dependency library detection is automatic. See the notes at the top 172# of this file, for how to force or disable dependencies completely. 173option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF) 174option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF) 175option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF) 176option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF) 177option(FT_WITH_BROTLI "Support compressed WOFF2 fonts." OFF) 178 179 180# Disallow in-source builds 181if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") 182 message(FATAL_ERROR 183 "In-source builds are not permitted! Make a separate folder for" 184 " building, e.g.,\n" 185 " cmake -E make_directory build\n" 186 " cmake -E chdir build cmake ..\n" 187 "Before that, remove the files created by this failed run with\n" 188 " cmake -E remove CMakeCache.txt\n" 189 " cmake -E remove_directory CMakeFiles") 190endif () 191 192 193# Add local cmake modules 194list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake) 195 196 197if (BUILD_FRAMEWORK) 198 if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode") 199 message(FATAL_ERROR 200 "You should use Xcode generator with BUILD_FRAMEWORK enabled") 201 endif () 202 set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_64_BIT)") 203 set(BUILD_SHARED_LIBS ON) 204endif () 205 206 207# Find dependencies 208set(HARFBUZZ_MIN_VERSION "1.8.0") 209if (FT_WITH_HARFBUZZ) 210 find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED) 211else () 212 find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION}) 213endif () 214 215if (FT_WITH_PNG) 216 find_package(PNG REQUIRED) 217else () 218 find_package(PNG) 219endif () 220 221if (FT_WITH_ZLIB) 222 find_package(ZLIB REQUIRED) 223else () 224 find_package(ZLIB) 225endif () 226 227if (FT_WITH_BZIP2) 228 find_package(BZip2 REQUIRED) 229else () 230 find_package(BZip2) 231endif () 232 233if (FT_WITH_BROTLI) 234 find_package(BrotliDec REQUIRED) 235else () 236 find_package(BrotliDec) 237endif () 238 239# Create the configuration file 240if (UNIX) 241 check_include_file("unistd.h" HAVE_UNISTD_H) 242 check_include_file("fcntl.h" HAVE_FCNTL_H) 243 244 file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.h.in" 245 FTCONFIG_H) 246 if (HAVE_UNISTD_H) 247 string(REGEX REPLACE 248 "#undef +(HAVE_UNISTD_H)" "#define \\1 1" 249 FTCONFIG_H "${FTCONFIG_H}") 250 endif () 251 if (HAVE_FCNTL_H) 252 string(REGEX REPLACE 253 "#undef +(HAVE_FCNTL_H)" "#define \\1 1" 254 FTCONFIG_H "${FTCONFIG_H}") 255 endif () 256else () 257 file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h" 258 FTCONFIG_H) 259endif () 260 261set(FTCONFIG_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h") 262if (EXISTS "${FTCONFIG_H_NAME}") 263 file(READ "${FTCONFIG_H_NAME}" ORIGINAL_FTCONFIG_H) 264else () 265 set(ORIGINAL_FTCONFIG_H "") 266endif () 267if (NOT (ORIGINAL_FTCONFIG_H STREQUAL FTCONFIG_H)) 268 file(WRITE "${FTCONFIG_H_NAME}" "${FTCONFIG_H}") 269endif () 270 271 272# Create the options file 273file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h" 274 FTOPTION_H) 275if (ZLIB_FOUND) 276 string(REGEX REPLACE 277 "/\\* +(#define +FT_CONFIG_OPTION_SYSTEM_ZLIB) +\\*/" "\\1" 278 FTOPTION_H "${FTOPTION_H}") 279endif () 280if (BZIP2_FOUND) 281 string(REGEX REPLACE 282 "/\\* +(#define +FT_CONFIG_OPTION_USE_BZIP2) +\\*/" "\\1" 283 FTOPTION_H "${FTOPTION_H}") 284endif () 285if (PNG_FOUND) 286 string(REGEX REPLACE 287 "/\\* +(#define +FT_CONFIG_OPTION_USE_PNG) +\\*/" "\\1" 288 FTOPTION_H "${FTOPTION_H}") 289endif () 290if (HARFBUZZ_FOUND) 291 string(REGEX REPLACE 292 "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1" 293 FTOPTION_H "${FTOPTION_H}") 294endif () 295if (BROTLIDEC_FOUND) 296 string(REGEX REPLACE 297 "/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1" 298 FTOPTION_H "${FTOPTION_H}") 299endif () 300 301set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h") 302if (EXISTS "${FTOPTION_H_NAME}") 303 file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H) 304else () 305 set(ORIGINAL_FTOPTION_H "") 306endif () 307if (NOT (ORIGINAL_FTOPTION_H STREQUAL FTOPTION_H)) 308 file(WRITE "${FTOPTION_H_NAME}" "${FTOPTION_H}") 309endif () 310 311 312file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h") 313file(GLOB PUBLIC_CONFIG_HEADERS "include/freetype/config/*.h") 314file(GLOB PRIVATE_HEADERS "include/freetype/internal/*.h") 315 316 317set(BASE_SRCS 318 src/autofit/autofit.c 319 src/base/ftbase.c 320 src/base/ftbbox.c 321 src/base/ftbdf.c 322 src/base/ftbitmap.c 323 src/base/ftcid.c 324 src/base/ftfstype.c 325 src/base/ftgasp.c 326 src/base/ftglyph.c 327 src/base/ftgxval.c 328 src/base/ftinit.c 329 src/base/ftmm.c 330 src/base/ftotval.c 331 src/base/ftpatent.c 332 src/base/ftpfr.c 333 src/base/ftstroke.c 334 src/base/ftsynth.c 335 src/base/fttype1.c 336 src/base/ftwinfnt.c 337 src/bdf/bdf.c 338 src/bzip2/ftbzip2.c 339 src/cache/ftcache.c 340 src/cff/cff.c 341 src/cid/type1cid.c 342 src/gzip/ftgzip.c 343 src/lzw/ftlzw.c 344 src/pcf/pcf.c 345 src/pfr/pfr.c 346 src/psaux/psaux.c 347 src/pshinter/pshinter.c 348 src/psnames/psnames.c 349 src/raster/raster.c 350 src/sfnt/sfnt.c 351 src/smooth/smooth.c 352 src/truetype/truetype.c 353 src/type1/type1.c 354 src/type42/type42.c 355 src/winfonts/winfnt.c 356) 357 358if (UNIX) 359 list(APPEND BASE_SRCS "builds/unix/ftsystem.c") 360else () 361 list(APPEND BASE_SRCS "src/base/ftsystem.c") 362endif () 363 364if (WIN32) 365 enable_language(RC) 366 list(APPEND BASE_SRCS builds/windows/ftdebug.c 367 src/base/ftver.rc) 368elseif (WINCE) 369 list(APPEND BASE_SRCS builds/wince/ftdebug.c) 370else () 371 list(APPEND BASE_SRCS src/base/ftdebug.c) 372endif () 373 374if (BUILD_FRAMEWORK) 375 list(APPEND BASE_SRCS builds/mac/freetype-Info.plist) 376endif () 377 378 379if (NOT DISABLE_FORCE_DEBUG_POSTFIX) 380 set(CMAKE_DEBUG_POSTFIX d) 381endif () 382 383 384add_library(freetype 385 ${PUBLIC_HEADERS} 386 ${PUBLIC_CONFIG_HEADERS} 387 ${PRIVATE_HEADERS} 388 ${BASE_SRCS} 389) 390 391set_target_properties( 392 freetype PROPERTIES 393 C_VISIBILITY_PRESET hidden) 394 395target_compile_definitions( 396 freetype PRIVATE FT2_BUILD_LIBRARY) 397 398if (WIN32) 399 target_compile_definitions( 400 freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) 401 if (BUILD_SHARED_LIBS) 402 target_compile_definitions( 403 freetype PRIVATE DLL_EXPORT) 404 endif () 405endif () 406 407if (BUILD_SHARED_LIBS) 408 set_target_properties(freetype PROPERTIES 409 VERSION ${LIBRARY_VERSION} 410 SOVERSION ${LIBRARY_SOVERSION}) 411endif () 412 413# Pick up ftconfig.h and ftoption.h generated above, first. 414target_include_directories( 415 freetype 416 PUBLIC 417 $<INSTALL_INTERFACE:include/freetype2> 418 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> 419 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> 420 PRIVATE 421 ${CMAKE_CURRENT_BINARY_DIR}/include 422 ${CMAKE_CURRENT_SOURCE_DIR}/include 423 424 # Make <ftconfig.h> available for builds/unix/ftsystem.c. 425 ${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config 426) 427 428 429if (BUILD_FRAMEWORK) 430 set_property(SOURCE ${PUBLIC_CONFIG_HEADERS} 431 PROPERTY MACOSX_PACKAGE_LOCATION Headers/config 432 ) 433 set_target_properties(freetype PROPERTIES 434 FRAMEWORK TRUE 435 MACOSX_FRAMEWORK_INFO_PLIST builds/mac/freetype-Info.plist 436 PUBLIC_HEADER "${PUBLIC_HEADERS}" 437 XCODE_ATTRIBUTE_INSTALL_PATH "@rpath" 438 ) 439endif () 440 441 442set(PKG_CONFIG_REQUIRED_PRIVATE "") 443 444if (ZLIB_FOUND) 445 target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) 446 target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) 447 list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib") 448endif () 449if (BZIP2_FOUND) 450 target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) 451 target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS 452 list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "bzip2") 453endif () 454if (PNG_FOUND) 455 target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) 456 target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS}) 457 target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) 458 list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libpng") 459endif () 460if (HARFBUZZ_FOUND) 461 target_link_libraries(freetype PRIVATE ${HARFBUZZ_LIBRARIES}) 462 target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS}) 463 list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}") 464endif () 465if (BROTLIDEC_FOUND) 466 target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES}) 467 target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS}) 468 target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS}) 469 list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libbrotlidec") 470endif () 471 472 473# Installation 474include(GNUInstallDirs) 475 476if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) 477 install( 478 # Note the trailing slash in the argument to `DIRECTORY'! 479 DIRECTORY ${PROJECT_SOURCE_DIR}/include/ 480 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2 481 COMPONENT headers 482 PATTERN "internal" EXCLUDE 483 PATTERN "ftconfig.h" EXCLUDE 484 PATTERN "ftoption.h" EXCLUDE) 485 install( 486 FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h 487 ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h 488 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config 489 COMPONENT headers) 490endif () 491 492if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) 493 # Generate the pkg-config file 494 if (UNIX) 495 file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN) 496 497 string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}") 498 499 string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX} 500 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 501 string(REPLACE "%exec_prefix%" "\${prefix}" 502 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 503 string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}" 504 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 505 string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}" 506 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 507 string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}" 508 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 509 string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}" 510 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 511 string(REPLACE "%LIBS_PRIVATE%" "" # All libs support pkg-config 512 FREETYPE2_PC_IN ${FREETYPE2_PC_IN}) 513 514 set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc") 515 if (EXISTS "${FREETYPE2_PC_IN_NAME}") 516 file(READ "${FREETYPE2_PC_IN_NAME}" ORIGINAL_FREETYPE2_PC_IN) 517 else () 518 set(ORIGINAL_FREETYPE2_PC_IN "") 519 endif () 520 if (NOT (ORIGINAL_FREETYPE2_PC_IN STREQUAL FREETYPE2_PC_IN)) 521 file(WRITE "${FREETYPE2_PC_IN_NAME}" ${FREETYPE2_PC_IN}) 522 endif () 523 524 install( 525 FILES ${PROJECT_BINARY_DIR}/freetype2.pc 526 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig 527 COMPONENT pkgconfig) 528 endif () 529 530 include(CMakePackageConfigHelpers) 531 write_basic_package_version_file( 532 ${PROJECT_BINARY_DIR}/freetype-config-version.cmake 533 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 534 COMPATIBILITY SameMajorVersion) 535 536 install( 537 TARGETS freetype 538 EXPORT freetype-targets 539 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 540 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 541 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 542 FRAMEWORK DESTINATION Library/Frameworks 543 COMPONENT libraries) 544 install( 545 EXPORT freetype-targets 546 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype 547 FILE freetype-config.cmake 548 COMPONENT headers) 549 install( 550 FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake 551 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype 552 COMPONENT headers) 553endif () 554 555 556# Packaging 557set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) 558set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.") 559set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") 560set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/docs/LICENSE.TXT") 561 562set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) 563set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) 564set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) 565set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") 566 567if (WIN32) 568 set(CPACK_GENERATOR ZIP) 569else () 570 set(CPACK_GENERATOR TGZ) 571endif () 572 573set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") 574set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers") 575set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION 576 "Library used to build programs which use FreeType") 577set(CPACK_COMPONENT_HEADERS_DESCRIPTION 578 "C/C++ header files for use with FreeType") 579set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) 580set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") 581set(CPACK_COMPONENT_HEADERS_GROUP "Development") 582 583include(CPack) 584