diff options
author | Marcel Metz <[email protected]> | 2016-09-06 21:35:34 +0200 |
---|---|---|
committer | Marcel Metz <[email protected]> | 2016-09-06 21:43:01 +0200 |
commit | 6387933f8b7511b7b8078245511fc99525d8d0fd (patch) | |
tree | e66fde7dfc428d51f629392d615a8ff46783c7f3 /CMakeLists.txt | |
parent | a758cc82433ad4fd47aeac7e626dff4bd1fa739f (diff) |
Use GNUInstallDirs to place the build artifacts properly
CMake 2.8.5 added the GNUInstallDirs module, which provides various
variables following the CMAKE_INSTALL_*DIR pattern to allow users a more
flexible installation setup and to provide sensible defaults while
respecting distribution specific install locations like lib64 for RPM
based linux distributions or debian multiarch tuples.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d8f15153..5a75db44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMake build file list for OpenAL -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) PROJECT(OpenAL) @@ -24,6 +24,7 @@ INCLUDE(CheckCCompilerFlag) INCLUDE(CheckCSourceCompiles) INCLUDE(CheckTypeSize) include(CheckFileOffsetBits) +include(GNUInstallDirs) SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) @@ -44,8 +45,14 @@ OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON) OPTION(ALSOFT_AMBDEC_PRESETS "Install AmbDec preset files" ON) OPTION(ALSOFT_INSTALL "Install headers and libraries" ON) +if(DEFINED SHARE_INSTALL_DIR) + message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead") + set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}") +endif() -set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "The share install dir") +if(DEFINED LIB_SUFFIX) + message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead") +endif() IF(NOT WIN32) @@ -1204,9 +1211,9 @@ TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS}) IF(ALSOFT_INSTALL) # Add an install target here INSTALL(TARGETS ${LIBNAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) INSTALL(FILES include/AL/al.h include/AL/alc.h @@ -1214,10 +1221,10 @@ IF(ALSOFT_INSTALL) include/AL/efx.h include/AL/efx-creative.h include/AL/efx-presets.h - DESTINATION include/AL + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL ) INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" - DESTINATION "lib${LIB_SUFFIX}/pkgconfig") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ENDIF() @@ -1245,7 +1252,7 @@ endif() # Install alsoft.conf configuration file IF(ALSOFT_CONFIG) INSTALL(FILES alsoftrc.sample - DESTINATION ${SHARE_INSTALL_DIR}/openal + DESTINATION ${CMAKE_INSTALL_DATADIR}/openal ) MESSAGE(STATUS "Installing sample configuration") MESSAGE(STATUS "") @@ -1255,7 +1262,7 @@ ENDIF() IF(ALSOFT_HRTF_DEFS) INSTALL(FILES hrtf/default-44100.mhr hrtf/default-48000.mhr - DESTINATION ${SHARE_INSTALL_DIR}/openal/hrtf + DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf ) MESSAGE(STATUS "Installing HRTF definitions") MESSAGE(STATUS "") @@ -1269,7 +1276,7 @@ IF(ALSOFT_AMBDEC_PRESETS) presets/rectangle.ambdec presets/square.ambdec presets/presets.txt - DESTINATION ${SHARE_INSTALL_DIR}/openal/presets + DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets ) MESSAGE(STATUS "Installing AmbDec presets") MESSAGE(STATUS "") @@ -1294,9 +1301,9 @@ IF(ALSOFT_UTILS) IF(ALSOFT_INSTALL) INSTALL(TARGETS openal-info makehrtf bsincgen - RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() @@ -1317,9 +1324,9 @@ IF(ALSOFT_TESTS) IF(ALSOFT_INSTALL) INSTALL(TARGETS altonegen - RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() @@ -1372,9 +1379,9 @@ IF(ALSOFT_EXAMPLES) IF(ALSOFT_INSTALL) INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf - RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() @@ -1411,9 +1418,9 @@ IF(ALSOFT_EXAMPLES) IF(ALSOFT_INSTALL) INSTALL(TARGETS alffplay - RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() MESSAGE(STATUS "Building SDL and FFmpeg example programs") |