* CMakeLists.txt: Improve shared library support. Based on a patch from John Cary <cary@txcorp.com>.
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d22293..edcb64e 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 bdfabf5..7b35ece 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2015-08-02 Werner Lemberg <wl@gnu.org>
+ * CMakeLists.txt: Improve shared library support.
+
+ Based on a patch from John Cary <cary@txcorp.com>.
+
+2015-08-02 Werner Lemberg <wl@gnu.org>
+
* builds/unix/freetype-config.in (enable_shared): Remove. Unused.
2015-08-02 Werner Lemberg <wl@gnu.org>