Build: use -no-pie for portable builds on Linux

Otherwise file browsers do not recognize the Blender executable. This is
already done for official releases.

We leave it off for non-portable builds, since that's how Linux distribution
packages will typically build Blender and we can continue to follow the OS
default there. Using a file browser to launch executables from e.g. /usr/bin
would be rare as wel.

Differential Revision: https://developer.blender.org/D7363
This commit is contained in:
Brecht Van Lommel 2020-04-07 03:52:46 +02:00
parent e953ada0bb
commit aaaa0a43af
1 changed files with 7 additions and 0 deletions

View File

@ -606,3 +606,10 @@ endif()
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
# Don't use position independent executable for portable install since file
# browsers can't properly detect blender as an executable then. Still enabled
# for non-portable installs as typically used by Linux distributions.
if(WITH_INSTALL_PORTABLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()