| Summary: | CMake doesn't correctly install libSDL2.dylib Mac OS | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Drew Pirrone-Brusse <drew.pirrone.brusse> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Mac OS X (All) | ||
| Attachments: |
A patch that resolves this issue.
The same patch as previously, built from release-2.0.8 |
||
Created attachment 3309 [details]
The same patch as previously, built from release-2.0.8
The first patch I posted was cut from what was then master. I had cause to re-build the patch off of release-2.0.8, and decided that might be worth recording here.
Patch added, thanks! https://hg.libsdl.org/SDL/rev/c0b17b32b95e |
Created attachment 3285 [details] A patch that resolves this issue. When running `cmake --build . --target install`, libSDL2.dylib is not correctly installed on Mac OS. A patch has been included that fixes this issues. ## Repro Steps 1. Set up next-to-source build and install directories, `mkdir build install; cd build` 2. Configure CMake (installing to a dummy directory), `cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=../install` 3. Build, but don't install, `cmake --build .` 4. Note a .dylib that has been built, `ls -l libSDL2.dylib` ``` -rwxr-xr-x 1 drew staff 1.4M Aug 18 13:37 libSDL2.dylib* ``` 5. Install, `cmake --build . --target install` 6. Take a second look at that .dylib, `ls -l libSDL2.dylib` ``` lrwxr-xr-x 1 drew staff 17B Aug 18 13:39 libSDL2.dylib@ -> libSDL2-2.0.dylib ``` ## Notes The root issue are the target properties set on the `SDL2` target for the `APPLE` environment. `MACOSX_RPATH 1` is the only property set, and without `VERSION`, `SOVERSION`, or `OUTPUT_NAME`, the `-2.0` suffix isn't added to the generated dylib. This patch file also modifies the proceeding `create_symlink` call that expects to target the generated .dylib in a couple ways; 1. Use CMake's `CMAKE_SHARED_LIBRARY_SUFFIX` constant to choose between .so, .dylib, etc., rather than guessing based on platform. 2. The `SDL` target's `OUTPUT_NAME` is used in place of a hard-coded string. This doesn't immediately affect anything, but should the target's output name change in the future, the `create_symlink` call won't need to be updated. 3. Add the `SOPOSTFIX` ("d" for debug builds, "" for everything else) to the symlink's name to keep the symlink for debug builds distinct from the symlink for release builds. This is a possible duplicate of or corollary to 3713.