Skip to content

Commit

Permalink
Use GNUInstallDirs to install into /usr/lib64 as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski committed Aug 13, 2013
1 parent d6f05b8 commit 392d6bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ set(BUILDNAME "${osname}-${osrel}-${cpu}" CACHE STRING "Build name variab
ENDIF()
ENABLE_TESTING()
INCLUDE(CTest)
# For CMAKE_INSTALL_LIBDIR
INCLUDE(GNUInstallDirs)

IF(MSVC)
SET(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down Expand Up @@ -237,16 +239,16 @@ IF(NOT MSVC)
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ENDIF("${isSystemDir}" STREQUAL "-1")
ENDIF()

Expand Down
6 changes: 3 additions & 3 deletions liblib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ SET_TARGET_PROPERTIES(netcdf PROPERTIES
SOVERSION ${netCDF_SO_VERSION})

INSTALL(TARGETS netcdf EXPORT netcdf-targets RUNTIME DESTINATION bin COMPONENT libraries
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib COMPONENT libraries
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
)

SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)

FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")

0 comments on commit 392d6bc

Please sign in to comment.