aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-05-03 02:43:08 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-05-03 16:24:20 -0400
commit5a9b2cb8f8c8154e62b392ef3f1dbc94e8e1b319 (patch)
tree1b3616f4779282f7d8a8eda53364d2e24b03351a /mesonbuild/cmake
parent4ed5c0eefa731cd9e1ca6f432874536d101973db (diff)
downloadmeson-5a9b2cb8f8c8154e62b392ef3f1dbc94e8e1b319.zip
meson-5a9b2cb8f8c8154e62b392ef3f1dbc94e8e1b319.tar.gz
meson-5a9b2cb8f8c8154e62b392ef3f1dbc94e8e1b319.tar.bz2
cmake module: use more typed_pos_args for consistency
It's shorter and more descriptive. Although we always enforce the same rules either way, a unified decorator is one less line of code for each location, and also tells you how many "too few" arguments you *did* pass.
Diffstat (limited to 'mesonbuild/cmake')
-rw-r--r--mesonbuild/cmake/common.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/mesonbuild/cmake/common.py b/mesonbuild/cmake/common.py
index 32a8c68..3de6c16 100644
--- a/mesonbuild/cmake/common.py
+++ b/mesonbuild/cmake/common.py
@@ -23,6 +23,7 @@ import typing as T
if T.TYPE_CHECKING:
from ..environment import Environment
+ from ..interpreterbase import TYPE_var
language_map = {
'c': 'C',
@@ -121,16 +122,11 @@ def cmake_get_generator_args(env: 'Environment') -> T.List[str]:
assert backend_name in backend_generator_map
return ['-G', backend_generator_map[backend_name]]
-def cmake_defines_to_args(raw: T.Any, permissive: bool = False) -> T.List[str]:
+def cmake_defines_to_args(raw: T.List[T.Dict[str, TYPE_var]], permissive: bool = False) -> T.List[str]:
res = [] # type: T.List[str]
- if not isinstance(raw, list):
- raw = [raw]
for i in raw:
- if not isinstance(i, dict):
- raise MesonException('Invalid CMake defines. Expected a dict, but got a {}'.format(type(i).__name__))
for key, val in i.items():
- assert isinstance(key, str)
if key in blacklist_cmake_defs:
mlog.warning('Setting', mlog.bold(key), 'is not supported. See the meson docs for cross compilation support:')
mlog.warning(' - URL: https://mesonbuild.com/CMake-module.html#cross-compilation')