aboutsummaryrefslogtreecommitdiffstats
path: root/community/supertux/1152743f0bd369b4e1d3ff822e9d309fc7dac3e2.patch
blob: e977e42f81728918a45d8594c21b98f379ebf126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 1152743f0bd369b4e1d3ff822e9d309fc7dac3e2 Mon Sep 17 00:00:00 2001
From: Reiner Herrmann <reiner@reiner-h.de>
Date: Fri, 3 Jan 2020 14:27:15 +0000
Subject: [PATCH] Fix detection of system physfs (#1312)

check_symbol_exists checks if compilation succeeds with the specified
symbol and header, but also fails if linking is not successful.
To detect the system library correctly, ask it to link against
${PHYSFS_LIBRARY} (which is set by find_package).
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36bf4a67ac..3b8959a0fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,7 +221,10 @@ include_directories(SYSTEM ${VORBIS_INCLUDE_DIR})
 include(CheckSymbolExists)
 
 find_package(PhysFS)
-check_symbol_exists("PHYSFS_getPrefDir" "${PHYSFS_INCLUDE_DIR}/physfs.h" HAVE_PHYSFS_GETPREFDIR)
+if(PHYSFS_LIBRARY)
+  set(CMAKE_REQUIRED_LIBRARIES ${PHYSFS_LIBRARY})
+  check_symbol_exists("PHYSFS_getPrefDir" "${PHYSFS_INCLUDE_DIR}/physfs.h" HAVE_PHYSFS_GETPREFDIR)
+endif()
 if(HAVE_PHYSFS_GETPREFDIR)
   set(USE_SYSTEM_PHYSFS ON CACHE BOOL "Use preinstalled physfs (must support getPrefDir)")
 else(HAVE_PHYSFS_GETPREFDIR)