CMakeLists.txt: make positional code (-fPIC) customizible. (#616)

For some use cases it is necessary to specify -fPIC even if we build
static library e.g. building vst plugins (*.so) which may not load
shared libraries from outside the system paths (depends on DAWs).
For such environment we would like to build the final shared library
without depending on `libfluidsynth.so(.*)` but if we build libfluidsynth.a
it always comes without -fPIC. This change makes it adjustable.
This commit is contained in:
Atsushi Eno 2020-01-31 23:45:18 +09:00 committed by GitHub
parent a250ac2a97
commit 69ba49348a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,7 +121,9 @@ set(CMAKE_C_STANDARD 90)
# Compile with position independent code if the user requested a shared lib, i.e. no PIC if static requested.
# This is cmakes default behavior, but here it's explicitly required due to the use of libfluidsynth-OBJ as object library,
# which would otherwise always be compiled without PIC.
set ( CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} )
if ( NOT CMAKE_POSITION_INDEPENDENT_CODE )
set ( CMAKE_POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} )
endif ( CMAKE_POSITION_INDEPENDENT_CODE )
# the default global visibility level for all target
# no visibility support on OS2