@@ -1639,7 +1639,7 @@ def _cmake_add_custom_target(self, tline: CMakeTraceLine):
1639
1639
1640
1640
self .targets [tline .args [0 ]] = CMakeTarget (tline .args [0 ], 'CUSTOM' , {})
1641
1641
1642
- def _cmake_set_property (self , tline : CMakeTraceLine ):
1642
+ def _cmake_set_property (self , tline : CMakeTraceLine ) -> None :
1643
1643
# DOC: https://cmake.org/cmake/help/latest/command/set_property.html
1644
1644
args = list (tline .args )
1645
1645
@@ -1649,8 +1649,10 @@ def _cmake_set_property(self, tline: CMakeTraceLine):
1649
1649
1650
1650
append = False
1651
1651
targets = []
1652
- while len ( args ) > 0 :
1652
+ while args :
1653
1653
curr = args .pop (0 )
1654
+ # XXX: APPEND_STRING is specifically *not* supposed to create a
1655
+ # list, is treating them as aliases really okay?
1654
1656
if curr == 'APPEND' or curr == 'APPEND_STRING' :
1655
1657
append = True
1656
1658
continue
@@ -1660,31 +1662,29 @@ def _cmake_set_property(self, tline: CMakeTraceLine):
1660
1662
1661
1663
targets .append (curr )
1662
1664
1665
+ if not args :
1666
+ raise self ._gen_exception ('CMake: set_property() faild to parse argument list\n {}' .format (tline ))
1667
+
1663
1668
if len (args ) == 1 :
1664
1669
# Tries to set property to nothing so nothing has to be done
1665
1670
return
1666
1671
1667
- if len (args ) < 2 :
1668
- raise self ._gen_exception ('CMake: set_property() faild to parse argument list\n {}' .format (tline ))
1669
-
1670
- propName = args [0 ]
1671
- propVal = list (itertools .chain (* map (lambda x : x .split (';' ), args [1 :])))
1672
- propVal = list (filter (lambda x : len (x ) > 0 , propVal ))
1673
-
1674
- if len (propVal ) == 0 :
1672
+ identifier = args .pop (0 )
1673
+ value = ' ' .join (args ).split (';' )
1674
+ if not value :
1675
1675
return
1676
1676
1677
1677
for i in targets :
1678
1678
if i not in self .targets :
1679
1679
raise self ._gen_exception ('CMake: set_property() TARGET {} not found\n {}' .format (i , tline ))
1680
1680
1681
- if propName not in self .targets [i ].properies :
1682
- self .targets [i ].properies [propName ] = []
1681
+ if identifier not in self .targets [i ].properies :
1682
+ self .targets [i ].properies [identifier ] = []
1683
1683
1684
1684
if append :
1685
- self .targets [i ].properies [propName ] += propVal
1685
+ self .targets [i ].properies [identifier ] += value
1686
1686
else :
1687
- self .targets [i ].properies [propName ] = propVal
1687
+ self .targets [i ].properies [identifier ] = value
1688
1688
1689
1689
def _cmake_set_target_properties (self , tline : CMakeTraceLine ) -> None :
1690
1690
# DOC: https://cmake.org/cmake/help/latest/command/set_target_properties.html
0 commit comments