CMake ignores -DUSE_PULSEAUDIO=OFF
I'm trying to build Musescore without pulseaudio support. I have added -DUSE_PULSEAUDIO=OFF to the cmake command, but cmake manages to find some old compatibility libraries I have lying around and decides to use pulseaudio anyway. (And since I don't have the headers for these libraries, the compilation fails).
c012358e711c9445f81b55900e124e00c0eff2f1 patched to show USE_PULSEAUDIO value at beginning and end of CMakeLists.txt:
message("USE_PULSEAUDIO=${USE_PULSEAUDIO}")
$ cmake .. -DUSE_PULSEAUDIO=OFF 2>&1 | grep -i pulse USE_PULSEAUDIO=OFF -- checking for module 'libpulse' -- package 'libpulse' not found -- Found pulseaudio: /usr/lib32/libpulse.so Pulseaudio found. USE_PULSEAUDIO=1
The offending code:
## ## pulseaudio ## if (APPLE OR MINGW) set (USE_PULSEAUDIO 0) else (APPLE OR MINGW) if (PULSEAUDIO_FOUND) set(USE_PULSEAUDIO 1) message("Pulseaudio found.") else (PULSEAUDIO_FOUND) set(USE_PULSEAUDIO 0) message("Pulseaudio not found.") endif (PULSEAUDIO_FOUND) endif (APPLE OR MINGW)
Is this variable not meant to be user-settable? Can you change it to be user-settable?
(Interestingly, FindPulseAudio reports pulseaudio as found even though the include dir is not found. But it is a separate issue.
PULSEAUDIO_LIBRARY=/usr/lib32/libpulse.so PULSEAUDIO_INCLUDE_DIR=PULSEAUDIO_INCLUDE_DIR-NOTFOUND
)
//Thomas Axelsson
Comments
I have been looking some more at CMakeLists.txt, and I see that other optionals have the BUILD_ prefix, so I created a patch with BUILD_PULSEAUDIO. It behaves the same as BUILD_LAME: default ON but silently turns off Pulseaudio support if Pulseaudio is not found/supported.
edit.
Diff without whitespace changes:
Pull request PR #2333
https://github.com/musescore/MuseScore/pull/2333
Related Gentoo bug report: https://bugs.gentoo.org/show_bug.cgi?id=570588
Fixed in branch master, commit 413fdc3a1c
fix #92521: make pulseaudio support optional
Fixed in branch master, commit 937d977ea1
Merge pull request #2333 from thomasa88/92521-optional-pulseaudio
fix #92521: make pulseaudio support optional
Fixed in branch 2.0.3, commit 647c4161e7
fix #92521: make pulseaudio support optional
Automatically closed -- issue fixed for 2 weeks with no activity.