cmake: Use new GNUInstallDirs module for BINDIR and LIBDIR.

Should automatically correct libdir handling for 64 bit linux distros.

See also:
http://public.kitware.com/Bug/view.php?id=3976
http://public.kitware.com/Bug/view.php?id=11964
This commit is contained in:
Mike Gilbert 2011-12-05 23:34:29 -05:00
parent 806df4aea4
commit 7cf1ea6a29

View File

@ -27,6 +27,19 @@ include(CheckLibraryExists)
include(FindPkgConfig)
include(TestBigEndian)
# GNUInstallDirs is a relatively new cmake module
include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GID_PATH)
if(GID_PATH EQUAL NOTFOUND)
# Set default libdir
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "object code libraries (lib)")
endif()
# Set default bindir
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
endif()
endif()
# Include our extra modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
@ -47,16 +60,6 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# Set default libdir
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
# Set default bindir
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin")
endif()
# build shared libs
if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)