From 8b173ba3eb26432ba4975bf247d665aaa181dca7 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Thu, 23 Jun 2022 14:25:35 +0100
Subject: [PATCH] attempt to work around debian packging differences

---
 fggl/audio/openal/CMakeLists.txt | 19 +++++++++++++------
 fggl/phys/bullet/CMakeLists.txt  |  3 ++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fggl/audio/openal/CMakeLists.txt b/fggl/audio/openal/CMakeLists.txt
index 0e2bc57..28ede18 100644
--- a/fggl/audio/openal/CMakeLists.txt
+++ b/fggl/audio/openal/CMakeLists.txt
@@ -1,13 +1,20 @@
 find_package( OpenAL CONFIG )
 if ( NOT OpenAL_FOUND )
-    # ubuntu openal-soft package doesn't seem to have a config file
+    # ubuntu/debian openal-soft package doesn't seem to have a config file
+    # it's probably falling back to findOpenAL.cmake
+    message( STATUS "Using OpenAL-Soft config missing - falling back" )
     find_package( OpenAL REQUIRED )
-endif()
-
-if ( TARGET OpenAL::OpenAL )
-    target_link_libraries( fggl PUBLIC OpenAL::OpenAL )
+    target_link_libraries( fggl public ${OPENAL_LIBRARY} )
+    target_include_directories( fggl public ${OPENAL_INCLUDE_DIR} )
 else()
-    target_link_libraries( fggl PUBLIC OpenAL )
+    # we're using target-based
+    message( STATUS "Using OpenAL-Soft config file" )
+    if ( TARGET OpenAL::OpenAL )
+        target_link_libraries( fggl PUBLIC OpenAL::OpenAL )
+    else()
+        target_link_libraries( fggl PUBLIC OpenAL )
+    endif()
+
 endif()
 
 target_sources(fggl
diff --git a/fggl/phys/bullet/CMakeLists.txt b/fggl/phys/bullet/CMakeLists.txt
index 1530ad3..da6eb58 100644
--- a/fggl/phys/bullet/CMakeLists.txt
+++ b/fggl/phys/bullet/CMakeLists.txt
@@ -3,7 +3,7 @@ find_package( Bullet CONFIG )
 if ( NOT Bullet_FOUND )
     message(WARNING "Bullet not found - disabling bullet physics integration")
 else()
-    message(STATUS "Bullet found")
+    message( STATUS "Bullet is poorly packaged, you might need to disable support for it" )
 
     if ( MSVC )
         # see https://github.com/microsoft/vcpkg/issues/7877
@@ -13,6 +13,7 @@ else()
         target_compile_definitions(fggl PUBLIC ${BULLET_DEFINITIONS})
 
         if ( BULLET_INCLUDE_DIRS STREQUAL "include/bullet" )
+            message( STATUS "Bullet include path is relative - hard-coding" )
             # FIXME possible debian packing bug: path is relative in BulletConfig.cmake
             # FIXME debian packaging bug: BulletConfig.cmake lists BulletInverseDynamics, but that's packaged in bullet-extras
             target_include_directories(fggl PUBLIC ${BULLET_ROOT_DIR}/${BULLET_INCLUDE_DIRS})
-- 
GitLab