Enable QtMultimedia (or whatever QSound needs) using CMake
My question probably boils down to "what's called a module".
I would like to use the QSound class in Qt 5.4 and apparently the "Qt5Multimedia" module is not next to QtGui and QtCore when called
find_package(Qt5Widgets REQUIRED)
So, I browse my Qt 5.4 installation (local on Debian) and actually find the directory
~/sw/Qt/Qt_5_4/5.4/gcc_64/lib/cmake/Qt5Multimedia
However, naively adding
find_package(Qt5Multimedia REQUIRED)
to my CMakeLists.txt this paraphrasis "File error not found" fails:
By not providing "FindQt5Multimedia.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5Multimedia", but CMake did not find one.
So, in the specified directory, I ask ls -1 and actually get more than I wanted:
Qt5Multimedia_CameraBinServicePlugin.cmake
Qt5MultimediaConfig.cmake
Qt5MultimediaConfigVersion.cmake
Qt5Multimedia_QAlsaPlugin.cmake
Qt5Multimedia_QGstreamerAudioDecoderServicePlugin.cmake
Qt5Multimedia_QGstreamerCaptureServicePlugin.cmake
Qt5Multimedia_QGstreamerPlayerServicePlugin.cmake
Qt5Multimedia_QM3uPlaylistPlugin.cmake
Qt5Multimedia_QPulseAudioPlugin.cmake
Can any of you tell me what to take, if any, so I can use the QSound class to play some .wav files?
source to share
Converting my comment to this answer to close this question:
CMake needs to know where certain Qt5 files are located. Therefore you have to add ~/sw/Qt/Qt_5_4/5.4/gcc_64/
either to the environment variable $CMAKE_PREFIX_PATH
or set it with
set(CMAKE_PREFIX_PATH "~/sw/Qt/Qt_5_4/5.4/gcc_64/")
CMake will then be able to execute find_package(Qt5Multimedia)
.
source to share