[Commits] SDL: Correct the name of the SDL shared library in CMake for Mac OS

libsdl.org revision control commits-owner at libsdl.org
Mon Sep 24 08:45:04 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/c0b17b32b95e
changeset: 12200:c0b17b32b95e
user:      Drew Pirrone-Brusse <drew.pirrone.brusse at gmail.com>
date:      Sat Aug 18 17:23:40 2018 -0400
description:
Correct the name of the SDL shared library in CMake for Mac OS

diffstat:

 CMakeLists.txt |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r 4972784f494e -r c0b17b32b95e CMakeLists.txt
--- a/CMakeLists.txt	Mon Sep 24 08:41:59 2018 -0700
+++ b/CMakeLists.txt	Sat Aug 18 17:23:40 2018 -0400
@@ -1727,7 +1727,9 @@
 if(SDL_SHARED)
   add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
   if(APPLE)
-    set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1)
+    set_target_properties(SDL2 PROPERTIES
+      MACOSX_RPATH 1
+      OUTPUT_NAME "SDL2-${LT_RELEASE}")
   elseif(UNIX AND NOT ANDROID)
     set_target_properties(SDL2 PROPERTIES
       VERSION ${LT_VERSION}
@@ -1840,17 +1842,14 @@
 
 if(NOT (WINDOWS OR CYGWIN))
   if(SDL_SHARED)
-    if (APPLE)
-        set(SOEXT "dylib")
-    else()
-        set(SOEXT "so")
-    endif()
+    set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc.
+    get_target_property(SONAME SDL2 OUTPUT_NAME)
     if(NOT ANDROID)
         install(CODE "
           execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-            \"libSDL2-2.0${SOPOSTFIX}.${SOEXT}\" \"libSDL2.${SOEXT}\")"
+            \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\")"
             WORKING_DIR "${SDL2_BINARY_DIR}")
-        install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
+        install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
     endif()
   endif()
   if(FREEBSD)


More information about the commits mailing list