From 0cda715d638a3e97df6b4268aa172fdab0bf29af Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Thu, 23 Jun 2022 13:54:06 +0100
Subject: [PATCH] work around relative paths in bulletconfig

---
 CMakeLists.txt                  | 4 ++--
 fggl/phys/bullet/CMakeLists.txt | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eb567c..e513287 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,6 @@ set(namespace "fggl")
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 
-include(GNUInstallDirs)
-
 option(FGGL_CONAN "Should we use conan to find missing dependencies?" OFF)
 option(FGGL_EXAMPLES "Should we build examples or just the library" ON)
 option(FGGL_DOCS "Should we build documentation?" ON)
@@ -24,6 +22,8 @@ project(fggl
 	HOMEPAGE_URL ""
 	LANGUAGES C CXX)
 
+include(GNUInstallDirs)
+
 if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
 
 	# slightly cleaner conan support
diff --git a/fggl/phys/bullet/CMakeLists.txt b/fggl/phys/bullet/CMakeLists.txt
index 05a92df..7c0a2a2 100644
--- a/fggl/phys/bullet/CMakeLists.txt
+++ b/fggl/phys/bullet/CMakeLists.txt
@@ -11,7 +11,13 @@ else()
     else()
         # FIXME: this shouldn't be necessary, for modern cmake, linking the libraries should be enough
         target_compile_definitions(fggl PUBLIC ${BULLET_DEFINITIONS})
-        target_include_directories(fggl PUBLIC ${BULLET_INCLUDE_DIR})
+
+        if ( BULLET_INCLUDE_DIRS STREQUAL "include/bullet" )
+            # FIXME This might actually be a packaging bug?
+            target_include_directories(fggl PUBLIC ${BULLET_ROOT_DIR}/${BULLET_INCLUDE_DIRS})
+        else()
+            target_include_directories(fggl PUBLIC ${BULLET_INCLUDE_DIRS})
+        endif()
         target_link_libraries(fggl PUBLIC ${BULLET_LIBRARIES})
     endif()
 
-- 
GitLab