diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-02-27 21:28:31 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-04-13 17:27:09 -0400 |
commit | b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9 (patch) | |
tree | 96c13c307755d882c82e86836c0abf16755be52a /test cases | |
parent | c649a2b8c59c9f49affca9bd89c126bfa0f54449 (diff) | |
download | meson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.zip meson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.tar.gz meson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.tar.bz2 |
dependencies: tighten type checking and fix cmake API violation for get_variable
dep.get_variable() only supports string values for pkg-config and
config-tool, because those interfaces use text communication, and
internal variables (from declare_dependency) operate the same way.
CMake had an oddity, where get_variable doesn't document that it allows
list values but apparently it miiiiiight work? Actually getting that
kind of result would be dangerously inconsistent though. Also, CMake
does not support lists so it's a lie. Strings that are *treated* as
lists with `;` splitting don't count...
We could do two things here:
- raise an error
- treat it as a string and return a string
It's not clear what the use case of get_variable() on a maybe-list is,
and should probably be a hard error. But that's controversial, so
instead we just return the original `;`-delimited string. It is probably
the wrong thing, but users are welcome to cope with that somehow on
their own.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/unit/63 cmake parser/meson.build | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test cases/unit/63 cmake parser/meson.build b/test cases/unit/63 cmake parser/meson.build index 061bab0..472561d 100644 --- a/test cases/unit/63 cmake parser/meson.build +++ b/test cases/unit/63 cmake parser/meson.build @@ -12,8 +12,8 @@ assert(dep.get_variable(cmake : 'VAR_WITH_SPACES_PS') == 'With Spaces', 'set(PAR assert(dep.get_variable(cmake : 'VAR_THAT_IS_UNSET', default_value : 'sentinal') == 'sentinal', 'set() to unset is incorrect') assert(dep.get_variable(cmake : 'CACHED_STRING_NS') == 'foo', 'set(CACHED) without spaces is incorrect') assert(dep.get_variable(cmake : 'CACHED_STRING_WS') == 'foo bar', 'set(CACHED STRING) with spaces is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_NS') == ['foo', 'bar'], 'set(CACHED STRING) without spaces is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_WS') == ['foo', 'foo bar', 'bar'], 'set(CACHED STRING[]) with spaces is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_NS') == 'foo;bar', 'set(CACHED STRING) without spaces is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_WS') == 'foo;foo bar;bar', 'set(CACHED STRING[]) with spaces is incorrect') # We don't support this, so it should be unset. -assert(dep.get_variable(cmake : 'ENV{var}', default_value : 'sentinal') == 'sentinal', 'set(ENV) should be ignored')
\ No newline at end of file +assert(dep.get_variable(cmake : 'ENV{var}', default_value : 'sentinal') == 'sentinal', 'set(ENV) should be ignored') |