Skip to content

Commit 2ace1ff

Browse files
committed
cmake: always use the -fPIC compiler flag
Some libraries may be built statically before being linked against game dll, so -fPIC would be required, and then we better compile everything with -fPIC.
1 parent 1d38dff commit 2ace1ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmake/DaemonFlags.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ else()
381381
# Don't set _FORTIFY_SOURCE in debug builds.
382382
endif()
383383

384+
try_c_cxx_flag(FPIC "-fPIC")
385+
384386
if (USE_HARDENING)
385387
# PNaCl accepts the flags but does not define __stack_chk_guard and __stack_chk_fail.
386388
if (NOT NACL)
@@ -395,8 +397,6 @@ else()
395397
try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")
396398

397399
if (NOT NACL OR (NACL AND GAME_PIE))
398-
try_c_cxx_flag(FPIC "-fPIC")
399-
400400
# The -pie flag requires -fPIC:
401401
# > ld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
402402
# This flag isn't used on macOS:

0 commit comments

Comments
 (0)