cmake: Fix ALSA "Unable to find..." warning
If cmake is invoked with -DSDL_ALSA=OFF, the misleading warning message "Unable to find the alsa development library" is printed. It's misleading because no attempt was actually made to find the ALSA development library. It's always printed by the CheckALSA macro if SDL_ALSA is false. This commit moves this warning message in the CheckALSA macro to being printed if ALSA_FOUND is false. However, I don't see an explicit warning message like this for the other macros that search for development libraries, so I wonder if the message shouldn't just be removed entirely. It seems redundant with the "Could NOT find ALSA ..." message generated by cmake. Before this commit: $ cmake -B build -DSDL_ALSA=OFF [...] CMake Warning at cmake/sdlchecks.cmake:125 (message): Unable to find the alsa development library Call Stack (most recent call first): CMakeLists.txt:1530 (CheckALSA) [...] -- Options: -- SDL_ALSA (Wanted: OFF): OFF [...] $ cmake -B build -DSDL_ALSA=ON [...] -- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR) [...] -- Options: -- SDL_ALSA (Wanted: ON): OFF [...] After this commit: $ cmake -B build -DSDL_ALSA=OFF [...] -- Options: -- SDL_ALSA (Wanted: OFF): OFF [...] $ cmake -B build -DSDL_ALSA=ON [...] -- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR) CMake Warning at cmake/sdlchecks.cmake:123 (message): Unable to find the alsa development library Call Stack (most recent call first): CMakeLists.txt:1530 (CheckALSA) [...] -- Options: -- SDL_ALSA (Wanted: ON): OFF [...] All of the cmake invocations above were without the libasound2-dev package installed.main
parent
5c9dbf65a3
commit
e3395a7585
|
@ -119,10 +119,11 @@ macro(CheckALSA)
|
|||
sdl_link_dependency(alsa LIBS ALSA::ALSA CMAKE_MODULE ALSA PKG_CONFIG_SPECS "${ALSA_PKG_CONFIG_SPEC}")
|
||||
endif()
|
||||
set(HAVE_SDL_AUDIO TRUE)
|
||||
else()
|
||||
message(WARNING "Unable to find the alsa development library")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_ALSA FALSE)
|
||||
message(WARNING "Unable to find the alsa development library")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
|
Loading…
Reference in New Issue