Skip to content

Commit

Permalink
add LIB_INSTALL_DIR override, fixes #213
Browse files Browse the repository at this point in the history
  • Loading branch information
vgough committed Sep 15, 2016
1 parent d83c40d commit 3fa633f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ option (USE_INTERNAL_TINYXML "use built-in TinyXML2" ON)
option (ENABLE_NLS "compile with Native Language Support (using gettext)" ON)
option (INSTALL_LIBENCFS "install libencfs" OFF)

if (NOT DEFINED LIB_INSTALL_DIR)
set (LIB_INSTALL_DIR lib)
endif ()

# We need C++ 11
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0)
# CMake 3.1 has built-in CXX standard checks.
Expand All @@ -43,11 +47,11 @@ if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
endif()
endif()

Expand Down Expand Up @@ -176,7 +180,7 @@ target_link_libraries(encfs
${Intl_LIBRARIES}
)
if (INSTALL_LIBENCFS)
install (TARGETS encfs DESTINATION lib)
install (TARGETS encfs DESTINATION ${LIB_INSTALL_DIR})
endif (INSTALL_LIBENCFS)

if (IWYU)
Expand All @@ -191,7 +195,7 @@ endif()


# Set RPATH to library install path.
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")

add_executable (encfs-bin encfs/main.cpp)
target_link_libraries (encfs-bin encfs)
Expand Down
2 changes: 1 addition & 1 deletion create-dev-pkg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdir build
cd build
cmake ..
cmake .. $@
make -j4
sudo checkinstall --install=no \
--pkgname="encfs" \
Expand Down

0 comments on commit 3fa633f

Please sign in to comment.