Skip to content

Commit

Permalink
Use CMAKE_INSTALL_RPATH on UNIX systems
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Jan 4, 2025
1 parent 0802d85 commit e826338
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions contrib/minizip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ include(CMakePackageConfigHelpers)
include(CheckTypeSize)
include(GNUInstallDirs)

if(APPLE)
set(_base @loader_path)
else()
set(_base $ORIGIN)
endif()
file(RELATIVE_PATH _relDir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH ${_base} ${_base}/${_relDir})

if(NOT CPACK_INCLUDED)
include(CPack)
endif(NOT CPACK_INCLUDED)
Expand Down Expand Up @@ -146,8 +155,8 @@ if(MINIZIP_BUILD_SHARED)
OUTPUT_NAME minizip
VERSION ${minizip_VERSION}
SOVERSION ${minizip_VERSION_MAJOR})
target_link_libraries(libminizip PUBLIC ZLIB::ZLIB
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
target_link_libraries(
libminizip PUBLIC ZLIB::ZLIB $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)

add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
Expand Down

0 comments on commit e826338

Please sign in to comment.