From 80d4c6215a4dfcbc616cc0c09797a9f2be63b05b Mon Sep 17 00:00:00 2001 From: ds-sloth <72112344+ds-sloth@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:32:55 -0400 Subject: [PATCH] CMakeLists.txt: respect global CMAKE_POSITION_INDEPENDENT_CODE flag --- build/cmake/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index c25b720f..c3189842 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -85,7 +85,11 @@ list(APPEND LZ4_CLI_SOURCES ${LZ4_SOURCES}) # LZ4_CLI always use liblz4 sources # Whether to use position independent code for the static library. If # we're building a shared library this is ignored and PIC is always # used. -option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ON) +if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ON) +else() + set(LZ4_POSITION_INDEPENDENT_LIB OFF CACHE BOOL "Use position independent code for static library (if applicable)" FORCE) +endif() # liblz4 include(GNUInstallDirs)