Turn ON PIC when BUILD_SHARED_LIBS is ON
This commit is contained in:
parent
e60c31af70
commit
bfcb4e7c92
1 changed files with 7 additions and 2 deletions
|
@ -215,19 +215,23 @@ add_library(utils OBJECT
|
||||||
utils.cpp
|
utils.cpp
|
||||||
utils.h)
|
utils.h)
|
||||||
|
|
||||||
set_target_properties(utils PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
||||||
target_include_directories(utils PUBLIC .)
|
target_include_directories(utils PUBLIC .)
|
||||||
target_compile_features(utils PUBLIC cxx_std_11) # don't bump
|
target_compile_features(utils PUBLIC cxx_std_11) # don't bump
|
||||||
target_link_libraries(utils PRIVATE ${LLAMA_EXTRA_LIBS})
|
target_link_libraries(utils PRIVATE ${LLAMA_EXTRA_LIBS})
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set_target_properties(utils PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(ggml OBJECT
|
add_library(ggml OBJECT
|
||||||
ggml.c
|
ggml.c
|
||||||
ggml.h)
|
ggml.h)
|
||||||
|
|
||||||
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
||||||
target_include_directories(ggml PUBLIC .)
|
target_include_directories(ggml PUBLIC .)
|
||||||
target_compile_features(ggml PUBLIC c_std_11) # don't bump
|
target_compile_features(ggml PUBLIC c_std_11) # don't bump
|
||||||
target_link_libraries(ggml PRIVATE Threads::Threads ${LLAMA_EXTRA_LIBS})
|
target_link_libraries(ggml PRIVATE Threads::Threads ${LLAMA_EXTRA_LIBS})
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(llama
|
add_library(llama
|
||||||
llama.cpp
|
llama.cpp
|
||||||
|
@ -237,6 +241,7 @@ target_include_directories(llama PUBLIC .)
|
||||||
target_compile_features(llama PUBLIC cxx_std_11) # don't bump
|
target_compile_features(llama PUBLIC cxx_std_11) # don't bump
|
||||||
target_link_libraries(llama PRIVATE utils ggml ${LLAMA_EXTRA_LIBS})
|
target_link_libraries(llama PRIVATE utils ggml ${LLAMA_EXTRA_LIBS})
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set_target_properties(llama PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
target_compile_definitions(llama PRIVATE LLAMA_SHARED LLAMA_BUILD)
|
target_compile_definitions(llama PRIVATE LLAMA_SHARED LLAMA_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue