From a82c45d53b6ba3e26c8be2e12dadc5a450e2b8f4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 2 Aug 2015 18:35:49 +0200 Subject: [PATCH] * CMakeLists.txt: Improve shared library support. Based on a patch from John Cary . --- CMakeLists.txt | 15 +++++++++++++++ ChangeLog | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d2229334..edcb64e87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,10 @@ else () endif () endif () +if (WIN32 AND BUILD_SHARED_LIBS) + message(FATAL_ERROR "Shared libraries not supported on Windows.") +endif () + project(freetype) @@ -136,7 +140,9 @@ endif () set(VERSION_MAJOR "2") set(VERSION_MINOR "6") set(VERSION_PATCH "0") + set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) # Compiler definitions for building the library @@ -302,6 +308,15 @@ add_library(freetype ) +if (BUILD_SHARED_LIBS) + set_target_properties(freetype PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${SHARED_LIBRARY_VERSION} + COMPILE_DEFINITIONS freetype_EXPORTS + ) +endif () + + if (BUILD_FRAMEWORK) set_property(SOURCE ${PUBLIC_CONFIG_HEADERS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/config diff --git a/ChangeLog b/ChangeLog index bdfabf58a..7b35ece10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-08-02 Werner Lemberg + + * CMakeLists.txt: Improve shared library support. + + Based on a patch from John Cary . + 2015-08-02 Werner Lemberg * builds/unix/freetype-config.in (enable_shared): Remove. Unused.