On May 27, 2013 11:18:29 PM Florian Jung wrote:
> Hi,
> 
> the AudioStreams (which also support stretching via the RubberBand
> library) finally compile. However, they won't link because we need to
> link in the rubberband library. How do i do this with CMake? Can please
> someone send, and possibly explain me the patch for the CMakeList.txt (i
> hope it goes there?)
> 
> greetings and thanks
> flo
> 

------------------
Method 1):
------------------
If the feature is optional, you'll want to add the option choice near the top
 of the top-level CMakeLists.txt:

option ( ENABLE_RUBBERBAND  "Enable RubberBand stretching support"  ON)

Then further down in the 'Optional packages' section:

if (ENABLE_RUBBERBAND)
      PKG_CHECK_MODULES(RUBBERBAND rubberband>=1.0)
      if (RUBBERBAND_FOUND)
            include_directories(${RUBBERBAND_INCLUDE_DIRS})
            set(RUBBERBAND_SUPPORT ON)
      endif (RUBBERBAND_FOUND)
else (ENABLE_RUBBERBAND)
      message("RUBBERBAND disabled")
endif (ENABLE_RUBBERBAND)

Then further down in 'Report errors and warnings and hints' section add:

if (ENABLE_RUBBERBAND AND (NOT RUBBERBAND_FOUND))
        message("** WARNING: rubberband (>= 1.0) was enabled, but development 
files were not found.")
endif (ENABLE_RUBBERBAND AND (NOT RUBBERBAND_FOUND))

And finally further down, in the summary printout:

summary_add("rubberband support" RUBBERBAND_SUPPORT)

Now, depending on where exactly this support is used, link the library.
For example for OSC, sndfile, and samplerate libraries, we link them
 in the "muse/CMakeLists.txt" file because they're used globally.
So you would do this, just after the 'Linkage' section:

if(RUBBERBAND_SUPPORT)
      target_link_libraries(core ${RUBBERBAND_LIBRARIES})
endif(RUBBERBAND_SUPPORT)


------------------
Method 2):
------------------
If the feature is *not* optional and must be there always, you'll want to
 add this in the 'Mandatory packages' section of the top-level CMakeLists.txt:

PKG_CHECK_MODULES(RUBBERBAND REQUIRED rubberband>=0.1.0)
include_directories(${RUBBERBAND_INCLUDE_DIRS})

Then further down in 'Report errors and warnings and hints' section add:

if (NOT RUBBERBAND_FOUND)
      message("** ERROR: rubberband >= 0.1.0 is required, but development files 
were not found.")
endif (NOT RUBBERBAND_FOUND)           

Now, depending on where exactly this support is used, link the library.
For example for OSC, sndfile, and samplerate libraries, we link them
 in the "muse/CMakeLists.txt" file because they're used globally.
So you would do this, inside the 'Linkage' section:

target_link_libraries(core
...
      ${RUBBERBAND_LIBRARIES}
...
)

------------------
That should pretty much do it. I hope...

Tim.

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer

Reply via email to