CMake: 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.
This commit is contained in:
Marcel Metz 2016-04-01 15:13:03 +02:00 committed by Nigel Stewart
parent 30df027756
commit 8042db9fa3

View File

@ -6,6 +6,8 @@ project (glew)
cmake_minimum_required (VERSION 2.8.7)
include(GNUInstallDirs)
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
endif()
@ -144,9 +146,9 @@ endif()
install ( TARGETS ${targets_to_install}
${MAYBE_EXPORT}
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}
FRAMEWORK DESTINATION lib${LIB_SUFFIX}
)
@ -172,7 +174,7 @@ if (BUILD_UTILS)
endif ()
install ( TARGETS glewinfo visualinfo
DESTINATION bin)
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
set (prefix ${CMAKE_INSTALL_PREFIX})
@ -187,20 +189,20 @@ set (requireslib glu)
configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY)
install(FILES ${GLEW_DIR}/glew.pc
DESTINATION lib/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install (FILES
${GLEW_DIR}/include/GL/wglew.h
${GLEW_DIR}/include/GL/glew.h
${GLEW_DIR}/include/GL/glxew.h
DESTINATION include/GL)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL)
if(MAYBE_EXPORT)
install(EXPORT glew-targets DESTINATION lib/cmake/glew
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
NAMESPACE GLEW::)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
DESTINATION lib/cmake/glew)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew)
endif()