We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5039 - sdl2-config.cmake uses incorrect shared library suffix on macOS
Summary: sdl2-config.cmake uses incorrect shared library suffix on macOS
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 2.0
Hardware: x86 Mac OS X (All)
: P2 major
Assignee: alexander.grund
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-17 02:22 UTC by Joshua Root
Modified: 2020-03-31 17:27 UTC (History)
2 users (show)

See Also:


Attachments
Proposed patch (1.48 KB, patch)
2020-03-17 07:52 UTC, alexander.grund
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Root 2020-03-17 02:22:56 UTC
In SLD2 2.0.12, sdl2-config.cmake.in hardcodes "libSDL2.so" as the library name, but the extension should be .dylib on macOS.

The affected code was added in https://hg.libsdl.org/SDL/rev/ef2d5382a887 in order to fix bug 4970. Previous discussion in that bug suggested using the CMAKE_SHARED_LIBRARY_SUFFIX variable (and CMAKE_STATIC_LIBRARY_SUFFIX for the static libs, though that may not vary between supported platforms).

Credit to Gcenx for reporting this in https://github.com/macports/macports-ports/pull/6581.
Comment 1 alexander.grund 2020-03-17 07:32:18 UTC
Will add a patch soon. Testing ATM
Comment 2 alexander.grund 2020-03-17 07:52:23 UTC
Created attachment 4263 [details]
Proposed patch

This should fix the issue. I verified it doesn't break on Linux using the shared and static targets SDL2::SDL2 and SDL2::SDL2-static

(Very) basic example CML:

cmake_minimum_required(VERSION 3.1)
project(main)
add_executable(${PROJECT_NAME} main.cpp)
find_package(SDL2 2.0.12 REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2)
Comment 3 Caleb Cornett 2020-03-31 02:23:30 UTC
Ran into this bug earlier today when building FAudio. Just wanted to additionally confirm that this patch solves the issue. Thanks for writing this fix, alexander.grund!
Comment 4 Sam Lantinga 2020-03-31 17:27:11 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/60f1e9fb5957