CMake: Fix FindSndio module

Fixes a bug where the module would set SNDIO_LIBRARY to NOT-FOUND
resulting in a CMake error when trying to link to ${SNDIO_LIBRARY}.
This commit is contained in:
Lukas W
2018-06-20 08:42:26 +02:00
parent d1c36d7b96
commit c45a21aac3
2 changed files with 12 additions and 10 deletions

View File

@@ -19,14 +19,16 @@ if(SNDIO_LIBRARY)
get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
endif(SNDIO_LIBRARY)
check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO)
if(HAVE_SNDIO)
message(STATUS "Found sndio: ${SNDIO_LIBRARY}")
else(HAVE_SNDIO)
message(STATUS "sndio not found")
check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SIO_OPEN)
find_path(SNDIO_INCLUDE_DIR sndio.h)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SNDIO DEFAULT_MSG SNDIO_LIBRARY SNDIO_INCLUDE_DIR HAVE_SIO_OPEN)
if(SNDIO_FOUND)
set(SNDIO_INCLUDE_DIRS "${SNDIO_INCLUDE_DIR}")
set(SNDIO_LIBRARIES "${SNDIO_LIBRARY}")
endif(HAVE_SNDIO)
set(SNDIO_FOUND ${HAVE_SNDIO})
find_path(SNDIO_INCLUDES sndio.h)
mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)
mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY SNDIO_INCLUDE_DIRS SNDIO_LIBRARIES)

View File

@@ -138,7 +138,7 @@ SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS}
${SDL_LIBRARY}
${PORTAUDIO_LIBRARIES}
${SOUNDIO_LIBRARY}
${SNDIO_LIBRARY}
${SNDIO_LIBRARIES}
${PULSEAUDIO_LIBRARIES}
${JACK_LIBRARIES}
${OGGVORBIS_LIBRARIES}