Skip to content

Commit 92c8abc

Browse files
committed
Centralized use of -fPIC
1 parent f26434a commit 92c8abc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source_common/compiler_helper.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ set(is_clangcl "$<AND:${is_msvc_fe},$<CXX_COMPILER_ID:Clang>>")
4242
# Compiler is upstream clang with the standard frontend
4343
set(is_clang "$<AND:${is_gnu_fe},$<CXX_COMPILER_ID:Clang,AppleClang>>")
4444

45-
# Utility macro to set standard compiler options
45+
# Utility macro to set standard compiler and linker options
4646
macro(lgl_set_build_options BUILD_TARGET_NAME)
4747

48+
# Layers are shared objects so must be position independent
49+
set_property(
50+
TARGET ${BUILD_TARGET_NAME}
51+
PROPERTY POSITION_INDEPENDENT_CODE ON)
52+
4853
target_compile_options(
4954
${BUILD_TARGET_NAME} PRIVATE
5055
# Minimized visibility warnings
@@ -67,5 +72,4 @@ macro(lgl_set_build_options BUILD_TARGET_NAME)
6772
${BUILD_TARGET_NAME} PRIVATE
6873
$<$<PLATFORM_ID:Android>:VK_USE_PLATFORM_ANDROID_KHR=1>
6974
$<$<PLATFORM_ID:Android>:LGL_LOG_TAG="${LGL_LOG_TAG}">)
70-
7175
endmacro()

0 commit comments

Comments
 (0)