Skip to content

Commit c45a21a

Browse files
Lukas WLukas W
authored andcommitted
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}.
1 parent d1c36d7 commit c45a21a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cmake/modules/FindSndio.cmake

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ if(SNDIO_LIBRARY)
1919
get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
2020
endif(SNDIO_LIBRARY)
2121

22-
check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO)
23-
if(HAVE_SNDIO)
24-
message(STATUS "Found sndio: ${SNDIO_LIBRARY}")
25-
else(HAVE_SNDIO)
26-
message(STATUS "sndio not found")
27-
endif(HAVE_SNDIO)
28-
set(SNDIO_FOUND ${HAVE_SNDIO})
22+
check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SIO_OPEN)
23+
24+
find_path(SNDIO_INCLUDE_DIR sndio.h)
2925

30-
find_path(SNDIO_INCLUDES sndio.h)
26+
include(FindPackageHandleStandardArgs)
27+
find_package_handle_standard_args(SNDIO DEFAULT_MSG SNDIO_LIBRARY SNDIO_INCLUDE_DIR HAVE_SIO_OPEN)
28+
29+
if(SNDIO_FOUND)
30+
set(SNDIO_INCLUDE_DIRS "${SNDIO_INCLUDE_DIR}")
31+
set(SNDIO_LIBRARIES "${SNDIO_LIBRARY}")
32+
endif(HAVE_SNDIO)
3133

32-
mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)
34+
mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY SNDIO_INCLUDE_DIRS SNDIO_LIBRARIES)

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS}
138138
${SDL_LIBRARY}
139139
${PORTAUDIO_LIBRARIES}
140140
${SOUNDIO_LIBRARY}
141-
${SNDIO_LIBRARY}
141+
${SNDIO_LIBRARIES}
142142
${PULSEAUDIO_LIBRARIES}
143143
${JACK_LIBRARIES}
144144
${OGGVORBIS_LIBRARIES}

0 commit comments

Comments
 (0)