Prechádzať zdrojové kódy

cmake: avoid string(SUBSTRING) on short strings

CMake 3.1 and older throws an error when the input string is too short
Anonymous Maarten 2 rokov pred
rodič
commit
62297e7da5
1 zmenil súbory, kde vykonal 1 pridanie a 2 odobranie
  1. 1 2
      cmake/macros.cmake

+ 1 - 2
cmake/macros.cmake

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