From 0f0e42b975742c0918e0813b7a24247c197ed758 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Mon, 30 Jul 2012 01:04:08 +0100 Subject: [PATCH] Use SOVERSION for shared libraries on Unix-like systems. --- CMakeLists.txt | 10 ++++++++++ src/CMakeLists.txt | 7 ++++++- src/libglfw3.pc.in | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f082c3d7..d49a2aea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,16 @@ endif() #-------------------------------------------------------------------- set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW") +#-------------------------------------------------------------------- +# Choose library output name +#-------------------------------------------------------------------- +if (BUILD_SHARED_LIBS AND UNIX) + # On Unix-like systems, shared libraries can use the soname system. + set(GLFW_LIB_NAME glfw) +else() + set(GLFW_LIB_NAME glfw3) +endif() + #-------------------------------------------------------------------- # Add subdirectories #-------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 78cd1c07..926ef668 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,9 +30,14 @@ elseif (_GLFW_X11_GLX) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) -set_target_properties(glfw PROPERTIES OUTPUT_NAME "glfw3") +set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}") if (BUILD_SHARED_LIBS) + # Include version information in the output + set_target_properties(glfw PROPERTIES VERSION ${GLFW_VERSION}) + if (UNIX) + set_target_properties(glfw PROPERTIES SOVERSION ${GLFW_VERSION_MAJOR}) + endif() if (_GLFW_WIN32_WGL) # The GLFW DLL needs a special compile-time macro and import library name diff --git a/src/libglfw3.pc.in b/src/libglfw3.pc.in index 775819ed..175c902d 100644 --- a/src/libglfw3.pc.in +++ b/src/libglfw3.pc.in @@ -8,6 +8,6 @@ Description: A portable library for OpenGL, window and input Version: @GLFW_VERSION_FULL@ URL: http://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ -Libs: -L${libdir} -lglfw3 +Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs.private: @GLFW_PKG_LIBS@ Cflags: -I${includedir}