[cmake] Honor SKIP_INSTALL_* settings (as used in zlib).

As FreeType depends on zlib, if we don't install zlib (e.g., because
we defined SKIP_INSTALL_ALL), FreeType cannot be installed, too
(cmake triggers an error saying that FreeType cannot be installed
because zlib target isn't in the export set).

* CMakeLists.txt: Honor `SKIP_INSTALL_HEADERS',
`SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' settings.
This commit is contained in:
David Capello 2016-04-16 10:24:24 +02:00 committed by Werner Lemberg
parent 99eff67824
commit 9224f05393
2 changed files with 45 additions and 23 deletions

View File

@ -68,6 +68,11 @@
# only if it is available. Example: # only if it is available. Example:
# #
# cmake ... -DWITH_ZLIB=ON -DWITH_HarfBuzz=OFF ... # cmake ... -DWITH_ZLIB=ON -DWITH_HarfBuzz=OFF ...
#
# . Installation of FreeType can be controlled with the CMake variables
# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
# (this is compatible with the same CMake variables in zlib's CMake
# support).
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
@ -173,7 +178,7 @@ foreach (d ZLIB BZip2 PNG HarfBuzz)
if (${d}_FOUND OR ${D}_FOUND) if (${d}_FOUND OR ${D}_FOUND)
message(STATUS "Building with ${d}") message(STATUS "Building with ${d}")
endif() endif ()
endforeach () endforeach ()
@ -383,28 +388,33 @@ endif ()
# Installations # Installations
# Note the trailing slash in the argument to the `DIRECTORY' directive # Note the trailing slash in the argument to the `DIRECTORY' directive
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
DESTINATION include/freetype2 install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
PATTERN "internal" EXCLUDE DESTINATION include/freetype2
PATTERN "ftconfig.h" EXCLUDE PATTERN "internal" EXCLUDE
PATTERN "ftoption.h" EXCLUDE PATTERN "ftconfig.h" EXCLUDE
) PATTERN "ftoption.h" EXCLUDE
install(FILES )
${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h install(FILES
${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h
DESTINATION include/freetype2/freetype/config ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h
) DESTINATION include/freetype2/freetype/config
install(TARGETS freetype )
EXPORT freetype-targets endif ()
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
ARCHIVE DESTINATION lib install(TARGETS freetype
FRAMEWORK DESTINATION Library/Frameworks EXPORT freetype-targets
) RUNTIME DESTINATION bin
install(EXPORT freetype-targets LIBRARY DESTINATION lib
DESTINATION lib/cmake/freetype ARCHIVE DESTINATION lib
FILE freetype-config.cmake FRAMEWORK DESTINATION Library/Frameworks
) )
install(EXPORT freetype-targets
DESTINATION lib/cmake/freetype
FILE freetype-config.cmake
)
endif ()
# Packaging # Packaging

View File

@ -1,3 +1,15 @@
2016-04-16 David Capello <davidcapello@gmail.com>
[cmake] Honor SKIP_INSTALL_* settings (as used in zlib).
As FreeType depends on zlib, if we don't install zlib (e.g., because
we defined SKIP_INSTALL_ALL), FreeType cannot be installed, too
(cmake triggers an error saying that FreeType cannot be installed
because zlib target isn't in the export set).
* CMakeLists.txt: Honor `SKIP_INSTALL_HEADERS',
`SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' settings.
2016-04-16 Behdad Esfahbod <behdad@behdad.org> 2016-04-16 Behdad Esfahbod <behdad@behdad.org>
[truetype] Another fix for non-intermediate GX tuples. [truetype] Another fix for non-intermediate GX tuples.