sfizz/cmake/StringUtility.cmake

12 lines
360 B
CMake
Raw Normal View History

2021-04-04 16:28:08 +02:00
# SPDX-License-Identifier: BSD-2-Clause
function(string_left_pad VAR INPUT LENGTH FILLCHAR)
set(_output "${INPUT}")
string(LENGTH "${_output}" _length)
while(_length LESS "${LENGTH}")
string(PREPEND _output "${FILLCHAR}")
string(LENGTH "${_output}" _length)
endwhile()
set("${VAR}" "${_output}" PARENT_SCOPE)
endfunction()