Skip to content

Commit

Permalink
CMake: set rpath for shared objects
Browse files Browse the repository at this point in the history
this ensures the correct library is loaded when the install path is not
in the default search path; this matches the behavior of
autoconf/libtool

Change-Id: I7eaa458c353cbdb7f0a1f782a879c59662a5de79
  • Loading branch information
jzern committed Jul 25, 2022
1 parent 94cd711 commit b4994ea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -99,6 +99,12 @@ endif()
include(cmake/deps.cmake)
include(GNUInstallDirs)

if(BUILD_SHARED_LIBS AND NOT CMAKE_INSTALL_RPATH)
# Set the rpath to match autoconf/libtool behavior. Note this must be set
# before target creation.
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()

# ##############################################################################
# Options.
if(WEBP_ENABLE_SWAP_16BIT_CSP)
Expand Down

0 comments on commit b4994ea

Please sign in to comment.