Skip to content

Commit

Permalink
fix(cmake): Added PIC conditions to zlib and levelDB when PIPY_SHARED…
Browse files Browse the repository at this point in the history
… is ON (#183)
  • Loading branch information
naqvis committed Jun 13, 2024
1 parent 68b5252 commit c9c649e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" OFF)
option(LEVELDB_INSTALL "Install LevelDB's header and library" OFF)
add_subdirectory(deps/leveldb-1.23)

if(PIPY_SHARED AND UNIX AND NOT APPLE)
# Ensure position-independent code for static leveldb
set_target_properties(leveldb PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
Expand Down Expand Up @@ -116,6 +121,11 @@ else()
add_subdirectory(deps/zlib-1.3.1)
set(ZLIB_INC_DIR "${CMAKE_SOURCE_DIR}/deps/zlib-1.3.1" "${CMAKE_BINARY_DIR}/deps/zlib-1.3.1")
set(ZLIB_LIB zlibstatic)

if(PIPY_SHARED AND UNIX AND NOT APPLE)
# Ensure position-independent code for static zlib
set_target_properties(zlibstatic PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
endif(PIPY_USE_SYSTEM_ZLIB)
endif()

Expand Down

0 comments on commit c9c649e

Please sign in to comment.