File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,9 @@ add_library(utils OBJECT
218
218
target_include_directories (utils PUBLIC . )
219
219
target_compile_features (utils PUBLIC cxx_std_11 ) # don't bump
220
220
target_link_libraries (utils PRIVATE ${LLAMA_EXTRA_LIBS} )
221
+ if (BUILD_SHARED_LIBS )
222
+ set_target_properties (utils PROPERTIES POSITION_INDEPENDENT_CODE ON )
223
+ endif ()
221
224
222
225
add_library (ggml OBJECT
223
226
ggml.c
@@ -226,6 +229,9 @@ add_library(ggml OBJECT
226
229
target_include_directories (ggml PUBLIC . )
227
230
target_compile_features (ggml PUBLIC c_std_11 ) # don't bump
228
231
target_link_libraries (ggml PRIVATE Threads::Threads ${LLAMA_EXTRA_LIBS} )
232
+ if (BUILD_SHARED_LIBS )
233
+ set_target_properties (ggml PROPERTIES POSITION_INDEPENDENT_CODE ON )
234
+ endif ()
229
235
230
236
add_library (llama
231
237
llama.cpp
@@ -234,6 +240,10 @@ add_library(llama
234
240
target_include_directories (llama PUBLIC . )
235
241
target_compile_features (llama PUBLIC cxx_std_11 ) # don't bump
236
242
target_link_libraries (llama PRIVATE utils ggml ${LLAMA_EXTRA_LIBS} )
243
+ if (BUILD_SHARED_LIBS )
244
+ set_target_properties (llama PROPERTIES POSITION_INDEPENDENT_CODE ON )
245
+ target_compile_definitions (llama PRIVATE LLAMA_SHARED LLAMA_BUILD )
246
+ endif ()
237
247
238
248
#
239
249
# Executables
You can’t perform that action at this time.
0 commit comments