cmake: declutter root + remove obsolete variables

This commit is contained in:
Anonymous Maarten 2022-12-18 02:24:42 +01:00 committed by Sam Lantinga
parent 39a7abad7a
commit 653893f188
6 changed files with 25 additions and 46 deletions

View File

@ -22,7 +22,7 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{cmake_uninstall.cmake.in,test/CMakeLists.txt,./SDL3Config.cmake.in}]
[{cmake/cmake_uninstall.cmake.in,test/CMakeLists.txt,cmake/SDL3Config.cmake.in}]
indent_size = 4
indent_style = space
insert_final_newline = true

View File

@ -2915,34 +2915,15 @@ else()
set(sdl_static_libname "SDL3")
endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
if(SDL_STATIC)
set(ENABLE_STATIC_TRUE "")
set(ENABLE_STATIC_FALSE "#")
else()
set(ENABLE_STATIC_TRUE "#")
set(ENABLE_STATIC_FALSE "")
endif()
if(SDL_SHARED)
set(PKGCONFIG_LIBS_PRIV "
Libs.private:")
set(ENABLE_SHARED_TRUE "")
set(ENABLE_SHARED_FALSE "#")
set(PKGCONFIG_LIBS_PRIV "\nLibs.private:")
else()
set(PKGCONFIG_LIBS_PRIV "")
set(ENABLE_SHARED_TRUE "#")
set(ENABLE_SHARED_FALSE "")
endif()
# Clean up the different lists
listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
set(SDL_STATIC_LIBS ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
@ -2962,8 +2943,7 @@ endif()
# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}")
# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
configure_file("${SDL3_SOURCE_DIR}/sdl3.pc.in"
"${SDL3_BINARY_DIR}/sdl3.pc" @ONLY)
configure_file(cmake/sdl3.pc.in sdl3.pc @ONLY)
macro(check_add_debug_flag FLAG SUFFIX)
check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX})
@ -3299,7 +3279,7 @@ if(NOT SDL3_DISABLE_INSTALL)
##### Export files #####
include(CMakePackageConfigHelpers)
configure_package_config_file(SDL3Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake"
configure_package_config_file(cmake/SDL3Config.cmake.in SDL3Config.cmake
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}"
)
@ -3373,13 +3353,10 @@ endif()
if(NOT SDL3_DISABLE_UNINSTALL)
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
endif()
endif()

View File

@ -1,10 +1,10 @@
if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach (file ${files})
foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
@ -14,5 +14,4 @@ foreach (file ${files})
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
endforeach(file)
endforeach()

View File

@ -68,19 +68,22 @@ macro(message_tested_option _NAME)
message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}")
endmacro()
macro(listtostr _LIST _OUTPUT)
function(listtostr LIST OUTPUT)
if(${ARGC} EQUAL 3)
# prefix for each element
set(_LPREFIX ${ARGV2})
set(LPREFIX ${ARGV2})
else()
set(_LPREFIX "")
set(LPREFIX "")
endif()
# Do not use string(REPLACE ";" " ") here to avoid messing up list
# entries
foreach(_ITEM ${${_LIST}})
set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
# Do not use string(REPLACE ";" " ") here to avoid messing up list entries
set(res)
foreach(ITEM ${${LIST}})
if(ITEM)
set(res "${res} ${LPREFIX}${ITEM}")
endif()
endforeach()
endmacro()
set(${OUTPUT} "${res}" PARENT_SCOPE)
endfunction()
function(listtostrrev _LIST _OUTPUT)
if(${ARGC} EQUAL 3)

View File

@ -1,9 +1,9 @@
# sdl pkg-config source file
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: sdl3
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.