Aim
Here are some examples showing how to use cmake find packet.
Learn from
Examples - use default modules
ALSA library
You can install the library first.
$ sudo apt-get install libasound2
You can put the following code into CMakeLists.txt.
# Handle ALSA / ASound libraries find_package(ALSA) if (ALSA_FOUND) message (STATUS "Info - Found ALSA library: ${ALSA_LIBRARY}") message (STATUS "Info - Found ALSA include: ${ALSA_INCLUDE_DIR}") else (ALSA_FOUND) message (FATAL_ERROR "Info - ALSA is not found") endif (ALSA_FOUND)
How can I know which variables I can use?
- Go to official web site 001 or official web site 002
- In ubuntu you can go to the installation path and find all the modules
- /usr/share/cmake-3.16/Modules
- FindALSA.cmake
沒有留言:
發佈留言