cmake: turn on CMAKE_POSITION_INDEPENDENT_CODE for shared

This prevents an error while linking libbx.a into libbgfx.so on linux
This commit is contained in:
Sandy Carter
2021-01-30 19:33:13 -05:00
committed by Sandy
parent 66f18daf5c
commit 970c3d0064

View File

@@ -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}")