mirror of https://github.com/libsdl-org/SDL
cmake: use CMAKE_INSTALL_LIBDIR instead of hardcoding "lib", etc.
These came from HaikuPorts, specifically this patchset:
462947dd4f/media-libs/libsdl2/patches/libsdl2-2.0.14.patchset
This is just the part that is _not_ Haiku-specific. I wanted this in a
separate commit though, since I'm not really a CMake expert; if this causes
problems and we need to bisect to it, we won't be confused about it being a
Haiku issue when we get here.
Fixes #4092.
(and probably others.)
This commit is contained in:
parent
403afdb558
commit
6956f4aa19
|
@ -2346,9 +2346,9 @@ if(NOT WINDOWS OR CYGWIN OR MINGW)
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
|
||||||
set(exec_prefix "\${prefix}")
|
set(exec_prefix "\${prefix}")
|
||||||
set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
|
set(libdir "${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(bindir "\${exec_prefix}/bin")
|
set(bindir "${CMAKE_INSTALL_BINDIR}")
|
||||||
set(includedir "\${prefix}/include")
|
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
if(SDL_STATIC)
|
if(SDL_STATIC)
|
||||||
set(ENABLE_STATIC_TRUE "")
|
set(ENABLE_STATIC_TRUE "")
|
||||||
set(ENABLE_STATIC_FALSE "#")
|
set(ENABLE_STATIC_FALSE "#")
|
||||||
|
@ -2538,7 +2538,7 @@ if(NOT WINDOWS_STORE)
|
||||||
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
|
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
|
||||||
# alias target for in-tree builds
|
# alias target for in-tree builds
|
||||||
add_library(SDL2::SDL2main ALIAS SDL2main)
|
add_library(SDL2::SDL2main ALIAS SDL2main)
|
||||||
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
|
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
|
||||||
set(_INSTALL_LIBS "SDL2main")
|
set(_INSTALL_LIBS "SDL2main")
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
|
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
|
||||||
|
@ -2582,7 +2582,7 @@ if(SDL_SHARED)
|
||||||
endif()
|
endif()
|
||||||
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
|
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
|
||||||
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
|
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
|
||||||
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
|
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
|
target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
|
||||||
else()
|
else()
|
||||||
|
@ -2656,15 +2656,15 @@ endif()
|
||||||
|
|
||||||
##### Installation targets #####
|
##### Installation targets #####
|
||||||
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
|
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
|
||||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
|
||||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
|
||||||
RUNTIME DESTINATION bin)
|
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 "lib${LIB_SUFFIX}/cmake/SDL2")
|
set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/SDL2")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
@ -2693,7 +2693,7 @@ foreach(_FNAME ${BIN_INCLUDE_FILES})
|
||||||
list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME})
|
list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME})
|
||||||
endforeach()
|
endforeach()
|
||||||
list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
|
list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
|
||||||
install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
|
install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2)
|
||||||
|
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
|
||||||
if (UPPER_BUILD_TYPE MATCHES DEBUG)
|
if (UPPER_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
@ -2711,7 +2711,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 "lib${LIB_SUFFIX}")
|
install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(FREEBSD)
|
if(FREEBSD)
|
||||||
|
@ -2719,9 +2719,9 @@ 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 "lib${LIB_SUFFIX}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/pkgconfig")
|
||||||
endif()
|
endif()
|
||||||
install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
|
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?
|
||||||
install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
|
install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue