From bc7fcf5daaefd08bc188d1fa3ca94062dd28efce Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Mon, 19 Jan 2015 12:50:54 +0100 Subject: [PATCH] OpenAL <1.15: check some additional include directories OpenAL's pkg-config database doesn't list include/AL as a location for AL headers, but including is unusable because some systems store the headers in OpenAL instead of AL. So check if the file can actually be found as and amend the include directory list otherwise. --- cmake/FindAudio.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cmake/FindAudio.cmake b/cmake/FindAudio.cmake index c3833ae68..7dba9fcc0 100644 --- a/cmake/FindAudio.cmake +++ b/cmake/FindAudio.cmake @@ -1,6 +1,6 @@ # OpenClonk, http://www.openclonk.org # -# Copyright (c) 2009-2014, The OpenClonk Team and contributors +# Copyright (c) 2009-2015, The OpenClonk Team and contributors # # Distributed under the terms of the ISC license; see accompanying file # "COPYING" for details. @@ -17,6 +17,22 @@ macro(__FINDAUDIO_FINDOPENAL) find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND AND NOT(APPLE)) pkg_check_modules(OpenAL "openal>=1.13") + # OpenAL pkg-config data before 1.15 doesn't have .../AL in the include + # path. But we don't want to have to specify because some + # systems use . So let's see if we find al.h in the list + # of directories that pkg_check_modules returned, and if not, add it to + # the include path. + if (OpenAL_FOUND) + find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS}) + if (NOT __findaudio_al_h) + find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS} PATH_SUFFIXES OpenAL AL) + if (__findaudio_al_h) + list(APPEND __findaudio_al_h ${OpenAL_INCLUDE_DIRS}) + set(OpenAL_INCLUDE_DIRS "${__findaudio_al_h}" CACHE INTERNAL "") + endif() + endif() + endif() + pkg_check_modules(Alut "freealut>=1.1.0") pkg_check_modules(OggVorbis "vorbisfile>=1.3.2" "vorbis>=1.3.2" "ogg>=1.2.2") else()