Fix breaking GNUInstallDirs cmake module $CMAKE_INSTALL_LIBDIR directory. Fix #4621

According to https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html
`${CMAKE_INSTALL_LIBDIR} ` is only variable which should be used as base
directory. Without that patch on 64 bit archs libraries, cmake modules and
pkgconfig file are installed for example in /usr/lib6464 base directory.
This patch fixes #4621.

Signed-off-by: Tomasz Kłoczko <koczek@github.com>
This commit is contained in:
Tomasz Kłoczko 2021-08-10 18:51:33 +01:00 committed by Ryan C. Gordon
parent 25f9ed87ff
commit ea9bece5ed
1 changed files with 5 additions and 5 deletions

View File

@ -2662,15 +2662,15 @@ endif()
##### Installation targets ##### ##### Installation targets #####
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
##### Export files ##### ##### Export files #####
if (WINDOWS) if (WINDOWS)
set(PKG_PREFIX "cmake") set(PKG_PREFIX "cmake")
else () else ()
set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/SDL2") set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2")
endif () endif ()
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
@ -2717,7 +2717,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW))
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\"
WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")")
install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}") install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif() endif()
endif() endif()
if(FREEBSD) if(FREEBSD)
@ -2725,7 +2725,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW))
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig")
else() else()
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif() endif()
install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}")
# TODO: what about the .spec file? Is it only needed for RPM creation? # TODO: what about the .spec file? Is it only needed for RPM creation?