Seen while updating cdogs-sdl:

    CMake Error at src/cdogs/CMakeLists.txt:242 (target_link_libraries):
      Target "cdogs" links to:

        SDL2_mixer::SDL2_mixer

      but the target was not found.  Possible reasons include:

        * There is a typo in the target name.
        * A find_package call is missing for an IMPORTED target.
        * An ALIAS target is missing.

I recognized this error: we've encountered it before with sdl2, sdl2-ttf
and sdl2-image. The fix was to patch the cmake files to include the .so
version in the shared library filename. I've duplicated their patch for
this port as well.

The other sdl2 ports use autotools, so we can't preemptively apply this
to them.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2-mixer/Makefile,v
diff -u -p -r1.18 Makefile
--- Makefile    25 Feb 2024 13:47:52 -0000      1.18
+++ Makefile    12 Jul 2024 19:14:37 -0000
@@ -2,7 +2,7 @@ V =             2.8.0
 COMMENT =      SDL2 multi-channel audio mixer library
 DISTNAME =     SDL2_mixer-${V}
 PKGNAME =      sdl2-mixer-${V}
-REVISION =     0
+REVISION =     1
 CATEGORIES =   devel audio
 
 SHARED_LIBS +=  SDL2_mixer             1.1     # 2.8.0
@@ -35,6 +35,9 @@ CONFIGURE_ARGS +=     --disable-music-midi-f
 USE_GMAKE =    Yes
 
 NO_TEST =      Yes
+
+pre-configure:
+       ${SUBST_CMD} ${WRKSRC}/sdl2_mixer-config.cmake.in
 
 post-install:
        ${INSTALL_PROGRAM} ${WRKBUILD}/build/.libs/playmus 
${PREFIX}/bin/play2mus
Index: patches/patch-sdl2_mixer-config_cmake_in
===================================================================
RCS file: patches/patch-sdl2_mixer-config_cmake_in
diff -N patches/patch-sdl2_mixer-config_cmake_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-sdl2_mixer-config_cmake_in    12 Jul 2024 19:14:37 -0000
@@ -0,0 +1,12 @@
+Index: sdl2_mixer-config.cmake.in
+--- sdl2_mixer-config.cmake.in.orig
++++ sdl2_mixer-config.cmake.in
+@@ -111,7 +111,7 @@ if(NOT TARGET SDL2_mixer::SDL2_mixer)
+         unset(_sdl2mixer_dll)
+         unset(_sdl2mixer_imp)
+     else()
+-        set(_sdl2mixer_shl 
"${_sdl2mixer_libdir}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2_mixer${CMAKE_SHARED_LIBRARY_SUFFIX}")
++        set(_sdl2mixer_shl 
"${_sdl2mixer_libdir}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2_mixer${CMAKE_SHARED_LIBRARY_SUFFIX}.${LIBSDL2_mixer_VERSION}")
+         if(EXISTS "${_sdl2mixer_shl}")
+             add_library(SDL2_mixer::SDL2_mixer SHARED IMPORTED)
+             set_target_properties(SDL2_mixer::SDL2_mixer

Reply via email to