Skip to content

Commit

Permalink
CMake: Fix FindSndio module
Browse files Browse the repository at this point in the history
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}.
  • Loading branch information
Lukas W authored and Lukas W committed Jun 20, 2018
1 parent d1c36d7 commit c45a21a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions cmake/modules/FindSndio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
endif(HAVE_SNDIO)
set(SNDIO_FOUND ${HAVE_SNDIO})
check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SIO_OPEN)

find_path(SNDIO_INCLUDE_DIR sndio.h)

find_path(SNDIO_INCLUDES 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)

mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)
mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY SNDIO_INCLUDE_DIRS SNDIO_LIBRARIES)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

1 comment on commit c45a21a

@lukas-w
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
WTF

Please sign in to comment.