cmake: avoid string(SUBSTRING) on short strings

CMake 3.1 and older throws an error when the input string is too short
main
Anonymous Maarten 2023-01-09 15:44:38 +01:00
parent 607ddd0e10
commit 62297e7da5
1 changed files with 1 additions and 2 deletions

View File

@ -78,8 +78,7 @@ function(listtostr LIST OUTPUT)
# Do not use string(REPLACE ";" " ") here to avoid messing up list entries # Do not use string(REPLACE ";" " ") here to avoid messing up list entries
set(res) set(res)
foreach(ITEM ${${LIST}}) foreach(ITEM ${${LIST}})
string(SUBSTRING "${ITEM}" 0 6 start) if(ITEM MATCHES "^SHELL:")
if(start STREQUAL "SHELL:")
string(SUBSTRING "${ITEM}" 6 -1 ITEM) string(SUBSTRING "${ITEM}" 6 -1 ITEM)
endif() endif()
if(ITEM) if(ITEM)