Fixed use of CMAKE_INSTALL_LIBDIR.

This commit is contained in:
Vincent Richard 2013-03-20 12:44:05 +01:00
parent da2797702f
commit 86925f15a8

View File

@ -84,13 +84,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
)
# Automatically set lib suffix
IF(UNIX AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/debian_version")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT LIB_SUFFIX)
SET(LIB_SUFFIX 64)
ENDIF()
ENDIF()
# Shared library
OPTION(
VMIME_BUILD_SHARED_LIBRARY
@ -159,20 +152,55 @@ ENDIF()
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
# Automatically set lib suffix
IF(UNIX AND NOT APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/debian_version")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT LIB_SUFFIX)
# ...only if LIB_SUFFIX is not defined...
IF(NOT DEFINED LIB_SUFFIX)
# ...and if CMAKE_INSTALL_LIBDIR does not already contain the suffix
IF(NOT "${CMAKE_INSTALL_LIBDIR}" MATCHES ".*64.*")
SET(LIB_SUFFIX 64)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
# Determine library installation dir, in this order:
# 1) use VMIME_INSTALL_LIBDIR if set
# 2) use LIB_INSTALL_DIR if defined
# 3) use CMAKE_INSTALL_LIBDIR if set
# if it is a relative path, prepend CMAKE_INSTALL_PREFIX to it
# 4) use CMAKE_INSTALL_PREFIX/lib
IF(NOT DEFINED VMIME_INSTALL_LIBDIR)
IF(DEFINED LIB_INSTALL_DIR)
SET(VMIME_INSTALL_LIBDIR ${LIB_INSTALL_DIR})
# respect CMAKE_INSTALL_LIBDIR if set
ELSEIF(DEFINED CMAKE_INSTALL_LIBDIR)
SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
IF(IS_ABSOLUTE ${VMIME_INSTALL_LIBDIR})
SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
ELSE()
SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
ENDIF()
ELSE()
SET(VMIME_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
ENDIF()
ENDIF()
# Installation of libraries
IF(VMIME_BUILD_SHARED_LIBRARY)
INSTALL(
TARGETS ${VMIME_LIBRARY_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT sharedlibs
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT sharedlibs
LIBRARY DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT sharedlibs
ARCHIVE DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT sharedlibs
)
ENDIF()
IF(VMIME_BUILD_STATIC_LIBRARY)
INSTALL(
TARGETS ${VMIME_LIBRARY_NAME}-static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT staticlibs
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT staticlibs
LIBRARY DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT staticlibs
ARCHIVE DESTINATION "${VMIME_INSTALL_LIBDIR}" COMPONENT staticlibs
)
ENDIF()
@ -327,18 +355,12 @@ ADD_CUSTOM_TARGET(
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
SET(includedir ${CMAKE_INSTALL_PREFIX}/include/vmime)
SET(libdir ${VMIME_INSTALL_LIBDIR})
SET(VMIME_PKGCONFIG_LIBS "")
SET(VMIME_PKGCONFIG_CFLAGS "")
SET(VMIME_PKGCONFIG_REQUIRES "")
IF(${UNIX})
SET(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
ENDIF(${UNIX})
IF(${WIN32})
SET(libdir ${CMAKE_INSTALL_PREFIX}/bin)
ENDIF(${WIN32})
##############################################################################
# Build type
@ -810,7 +832,7 @@ CONFIGURE_FILE(cmake/config.hpp.cmake ${CMAKE_SOURCE_DIR}/vmime/config.hpp)
# PkgConfig post-configuration
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libvmime.pc.in ${CMAKE_BINARY_DIR}/libvmime.pc @ONLY)
INSTALL(FILES ${CMAKE_BINARY_DIR}/libvmime.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT headers)
INSTALL(FILES ${CMAKE_BINARY_DIR}/libvmime.pc DESTINATION "${VMIME_INSTALL_LIBDIR}/pkgconfig" COMPONENT headers)
INCLUDE(CPack)