Fix CMakePackage.define for libs/headers (#28838)
The 'libs' property returned by a spec is not a list nor tuple. Closes #28836.
This commit is contained in:
parent
fa38af285c
commit
92b26257f4
@ -10,6 +10,9 @@
|
|||||||
import re
|
import re
|
||||||
from typing import List # novm
|
from typing import List # novm
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
from llnl.util.compat import Sequence
|
||||||
from llnl.util.filesystem import working_dir
|
from llnl.util.filesystem import working_dir
|
||||||
|
|
||||||
import spack.build_environment
|
import spack.build_environment
|
||||||
@ -222,7 +225,7 @@ def define(cmake_var, value):
|
|||||||
value = "ON" if value else "OFF"
|
value = "ON" if value else "OFF"
|
||||||
else:
|
else:
|
||||||
kind = 'STRING'
|
kind = 'STRING'
|
||||||
if isinstance(value, (list, tuple)):
|
if isinstance(value, Sequence) and not isinstance(value, six.string_types):
|
||||||
value = ";".join(str(v) for v in value)
|
value = ";".join(str(v) for v in value)
|
||||||
else:
|
else:
|
||||||
value = str(value)
|
value = str(value)
|
||||||
|
@ -313,6 +313,9 @@ def test_define(self):
|
|||||||
arg = pkg.define('MULTI', cls(['right', 'up']))
|
arg = pkg.define('MULTI', cls(['right', 'up']))
|
||||||
assert arg == '-DMULTI:STRING=right;up'
|
assert arg == '-DMULTI:STRING=right;up'
|
||||||
|
|
||||||
|
arg = pkg.define('MULTI', fs.FileList(['/foo', '/bar']))
|
||||||
|
assert arg == '-DMULTI:STRING=/foo;/bar'
|
||||||
|
|
||||||
arg = pkg.define('ENABLE_TRUTH', False)
|
arg = pkg.define('ENABLE_TRUTH', False)
|
||||||
assert arg == '-DENABLE_TRUTH:BOOL=OFF'
|
assert arg == '-DENABLE_TRUTH:BOOL=OFF'
|
||||||
arg = pkg.define('ENABLE_TRUTH', True)
|
arg = pkg.define('ENABLE_TRUTH', True)
|
||||||
|
Loading…
Reference in New Issue
Block a user