summarylogtreecommitdiffstats
path: root/0001-cmake-turn-on-CMAKE_POSITION_INDEPENDENT_CODE-for-sh.patch
blob: d1095f7ac550a5a10d51e6f8608149adee6f4ff1 (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
From db7e9cb07341043ac9949012d9e1a978fa7c8508 Mon Sep 17 00:00:00 2001
From: Sandy Carter <bwrsandman@gmail.com>
Date: Sat, 30 Jan 2021 19:33:13 -0500
Subject: [PATCH 1/4] cmake: turn on CMAKE_POSITION_INDEPENDENT_CODE for shared

This prevents an error while linking libbx.a into libbgfx.so on linux
---
 CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52a7315..4412be1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,10 @@ set( BGFX_LIBRARY_TYPE     "STATIC" CACHE STRING "Linking type for library" )
 
 set_property( CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED )
 
+if( BGFX_LIBRARY_TYPE MATCHES "SHARED" )
+    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+endif()
+
 if( NOT BX_DIR )
 	set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )
 elseif( NOT IS_ABSOLUTE "${BX_DIR}")
-- 
2.30.0