Re: [AD] CMake on Mac OS X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-09-12, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> I've had a go at finding that Vorbis library. I made a change to
> addons/acodec/CMakeLists.txt and added a file cmake/FindVorbis.cmake.
> Works for me, can someone test it?

Doesn't work for me.  Do you have a FindVorbis.cmake or
vorbis-config.cmake on your system?

Can you try this one instead?  I will be in #allegro-dev for a bit.


diff --git a/addons/acodec/CMakeLists.txt b/addons/acodec/CMakeLists.txt
index 4c5dc8f..0c671f8 100644
--- a/addons/acodec/CMakeLists.txt
+++ b/addons/acodec/CMakeLists.txt
@@ -33,26 +33,24 @@ if(WANT_FLAC)
 endif(WANT_FLAC)
 
 if(WANT_VORBIS)
-    check_c_source_compiles("
-        #include <vorbis/vorbisfile.h>
-        int main(void) {
-            (void)OV_CALLBACKS_NOCLOSE;
-            return 0;
-        }"
-        CAN_VORBIS
-        )
-
-    if(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY)
-        set(CAN_VORBIS 1)
-    endif(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY)
-
-    if(CAN_VORBIS)
+    find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
+    find_library(OGG_LIBRARY NAMES ogg)
+    find_library(VORBIS_LIBRARY NAMES vorbis)
+    find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
+    mark_as_advanced(VORBIS_INCLUDE_DIR)
+    mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
+
+    if(OGG_LIBRARY AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
         set(SUPPORT_VORBIS 1)
         set(ALLEGRO_CFG_ACODEC_VORBIS 1)
         include_directories(${VORBIS_INCLUDE_DIR})
-        list(APPEND ACODEC_EXTRA_LIBS vorbisfile vorbis ogg)
+        list(APPEND ACODEC_EXTRA_LIBS
+            ${VORBISFILE_LIBRARY}
+            ${VORBIS_LIBRARY}
+            ${OGG_LIBRARY}
+            )
         list(APPEND ACODEC_SOURCES ogg.c)
-    endif(CAN_VORBIS)
+    endif(OGG_LIBRARY AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
 endif(WANT_VORBIS)
 
 if(WANT_SNDFILE)






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/