Permalink
Browse files

use lib64 instead of lib for installing on select linux systems (#4789)

  • Loading branch information...
1 parent 4794f3e commit 7de296e4155722969d6b01e22493596c3b5585df @tbonfort tbonfort committed Oct 13, 2013
Showing with 35 additions and 9 deletions.
  1. +34 −8 CMakeLists.txt
  2. +1 −1 mapscript/java/CMakeLists.txt
View
@@ -15,7 +15,6 @@ include(CheckIncludeFile)
include(CheckCSourceCompiles)
-
set (MapServer_VERSION_MAJOR 6)
set (MapServer_VERSION_MINOR 4)
set (MapServer_VERSION_REVISION 0)
@@ -149,7 +148,33 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
-SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(_LIBDIR_DEFAULT "lib")
+ # Override this default 'lib' with 'lib64' iff:
+ # - we are on Linux system but NOT cross-compiling
+ # - we are NOT on debian
+ # - we are on a 64 bits system
+ # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
+ # Note that the future of multi-arch handling may be even
+ # more complicated than that: http://wiki.debian.org/Multiarch
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ AND NOT CMAKE_CROSSCOMPILING
+ AND NOT EXISTS "/etc/debian_version")
+ if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
+ message(AUTHOR_WARNING
+ "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
+ "Please enable at least one language before including GNUInstallDirs.")
+ else()
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(_LIBDIR_DEFAULT "lib64")
+ endif()
+ endif()
+ endif()
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+endif()
+
+SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_MACOSX_RPATH ON)
@@ -865,6 +890,7 @@ status_optional_feature("Apache Module (Experimental)" "${USE_APACHE_MODULE}")
message(STATUS "")
message(STATUS "Will install files to ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Will install libraries to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
include_directories("${PROJECT_BINARY_DIR}")
@@ -877,23 +903,23 @@ endif(WIN32)
#INSTALL(FILES mapserver-api.h ${PROJECT_BINARY_DIR}/mapserver-version.h DESTINATION include)
if(USE_ORACLE_PLUGIN)
- INSTALL(TARGETS msplugin_oracle DESTINATION lib)
+ INSTALL(TARGETS msplugin_oracle DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(USE_ORACLE_PLUGIN)
if(USE_MSSQL2008)
- INSTALL(TARGETS msplugin_mssql2008 DESTINATION lib)
+ INSTALL(TARGETS msplugin_mssql2008 DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(USE_MSSQL2008)
if(USE_SDE91)
- INSTALL(TARGETS msplugin_sde91 DESTINATION lib)
+ INSTALL(TARGETS msplugin_sde91 DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(USE_SDE91)
if(USE_SDE92)
- INSTALL(TARGETS msplugin_sde92 DESTINATION lib)
+ INSTALL(TARGETS msplugin_sde92 DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(USE_SDE92)
-INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
+INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(BUILD_STATIC)
- INSTALL(TARGETS mapserver_static DESTINATION lib)
+ INSTALL(TARGETS mapserver_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(BUILD_STATIC)
@@ -26,5 +26,5 @@ ADD_CUSTOM_COMMAND(TARGET javamapscript
)
get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_javamapscript_REAL_NAME} LOCATION)
-install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION lib)
+install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR})

0 comments on commit 7de296e

Please sign in to comment.