mirror of https://github.com/libsdl-org/SDL
cmake: Calculate padding for dislaying options automatically.
This commit is contained in:
parent
7850d0cf6f
commit
60d59aeb61
|
@ -313,6 +313,8 @@ if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(LONGESTOPTIONNAME 0) # set_option and friends will change this.
|
||||||
|
|
||||||
set(SDL_SUBSYSTEMS
|
set(SDL_SUBSYSTEMS
|
||||||
Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
|
Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
|
||||||
File Loadso CPUinfo Filesystem Dlopen Sensor Locale)
|
File Loadso CPUinfo Filesystem Dlopen Sensor Locale)
|
||||||
|
@ -2533,10 +2535,9 @@ message(STATUS "")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
list(SORT ALLOPTIONS)
|
list(SORT ALLOPTIONS)
|
||||||
foreach(_OPT ${ALLOPTIONS})
|
foreach(_OPT ${ALLOPTIONS})
|
||||||
# Longest option is SDL_WAYLAND_LIBDECOR_SHARED = 27 characters
|
|
||||||
# Get the padding
|
# Get the padding
|
||||||
string(LENGTH ${_OPT} _OPTLEN)
|
string(LENGTH ${_OPT} _OPTLEN)
|
||||||
math(EXPR _PADLEN "28 - ${_OPTLEN}")
|
math(EXPR _PADLEN "(${LONGESTOPTIONNAME} + 1) - ${_OPTLEN}")
|
||||||
string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
|
string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
|
||||||
message_tested_option(${_OPT} ${_PADDING})
|
message_tested_option(${_OPT} ${_PADDING})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
|
macro(ADD_TO_ALLOPTIONS _NEWNAME)
|
||||||
|
list(APPEND ALLOPTIONS ${_NEWNAME})
|
||||||
|
string(LENGTH ${_NEWNAME} _SLEN)
|
||||||
|
if(${LONGESTOPTIONNAME} LESS ${_SLEN})
|
||||||
|
set(LONGESTOPTIONNAME ${_SLEN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
macro(SET_OPTION _NAME _DESC)
|
macro(SET_OPTION _NAME _DESC)
|
||||||
list(APPEND ALLOPTIONS ${_NAME})
|
add_to_alloptions(${_NAME})
|
||||||
if(${ARGC} EQUAL 3)
|
if(${ARGC} EQUAL 3)
|
||||||
set(_DEFLT ${ARGV2})
|
set(_DEFLT ${ARGV2})
|
||||||
else()
|
else()
|
||||||
|
@ -9,12 +17,12 @@ macro(SET_OPTION _NAME _DESC)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(DEP_OPTION _NAME _DESC _DEFLT _DEPTEST _FAILDFLT)
|
macro(DEP_OPTION _NAME _DESC _DEFLT _DEPTEST _FAILDFLT)
|
||||||
list(APPEND ALLOPTIONS ${_NAME})
|
add_to_alloptions(${_NAME})
|
||||||
cmake_dependent_option(${_NAME} ${_DESC} ${_DEFLT} ${_DEPTEST} ${_FAILDFLT})
|
cmake_dependent_option(${_NAME} ${_DESC} ${_DEFLT} ${_DEPTEST} ${_FAILDFLT})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(OPTION_STRING _NAME _DESC _VALUE)
|
macro(OPTION_STRING _NAME _DESC _VALUE)
|
||||||
list(APPEND ALLOPTIONS ${_NAME})
|
add_to_alloptions(${_NAME})
|
||||||
set(${_NAME} ${_VALUE} CACHE STRING "${_DESC}")
|
set(${_NAME} ${_VALUE} CACHE STRING "${_DESC}")
|
||||||
set(HAVE_${_NAME} ${_VALUE})
|
set(HAVE_${_NAME} ${_VALUE})
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
Loading…
Reference in New Issue