properly use ${CMAKE_INSTALL_*DIR}

This commit is contained in:
Nico Schlömer 2015-06-17 14:52:55 +02:00
parent 1df444db6c
commit d6d4699298
2 changed files with 30 additions and 13 deletions

View File

@ -73,7 +73,7 @@ ENDIF()
###
# For CMAKE_INSTALL_LIBDIR
# For CMAKE_INSTALL_{LIBDIR,INCLUDEDIR,...}
INCLUDE(GNUInstallDirs)
IF(MSVC)
@ -422,10 +422,14 @@ IF(NOT MSVC)
# 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}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
LIST(FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_FULL_LIBDIR}"
isSystemDir
)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ENDIF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
ENDIF()
ENDIF()
@ -465,20 +469,25 @@ SET(LIBS "${TMP_NCXX_LIBS}")
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf-cxx.settings.in"
"${CMAKE_CURRENT_BINARY_DIR}/libnetcdf-cxx.settings"
@ONLY)
@ONLY
)
# Read in settings file, print out.
# Avoid using system-specific calls so that this
# might also work on Windows.
FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/libnetcdf-cxx.settings"
LIBNETCDFCXX_SETTINGS)
FILE(
READ "${CMAKE_CURRENT_BINARY_DIR}/libnetcdf-cxx.settings"
LIBNETCDFCXX_SETTINGS
)
MESSAGE(${LIBNETCDFCXX_SETTINGS})
# Install libnetcdf-cxx.settings file into same location
# as the libraries.
INSTALL(FILES "${NCXX_BINARY_DIR}/libnetcdf-cxx.settings"
INSTALL(
FILES "${NCXX_BINARY_DIR}/libnetcdf-cxx.settings"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT libraries)
COMPONENT libraries
)
#####
# End libnetcdf-cxx.settings section.

View File

@ -32,7 +32,15 @@ SET_TARGET_PROPERTIES(netcdf-cxx4 PROPERTIES
SOVERSION ${NCXX_SO_VERSION}
)
INSTALL(FILES ${CXX_HEADERS} DESTINATION include)
INSTALL(FILES netcdf DESTINATION include)
INSTALL(TARGETS netcdf-cxx4 DESTINATION lib)
INSTALL(
FILES ${CXX_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
INSTALL(
FILES netcdf
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
INSTALL(
TARGETS netcdf-cxx4
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)