diff options
author | Andrea Pappacoda <andrea@pappacoda.it> | 2022-02-01 17:39:46 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-02-01 23:48:17 -0500 |
commit | 316cf3a717744bd849a04de4a1625c06779f90a9 (patch) | |
tree | 75af043c065069309b03e9cc7b494ba8fb7c6b34 /mesonbuild/modules/cmake.py | |
parent | a755750caefad4ba04b4d9c0d0ad0fbf356349a2 (diff) | |
download | meson-316cf3a717744bd849a04de4a1625c06779f90a9.zip meson-316cf3a717744bd849a04de4a1625c06779f90a9.tar.gz meson-316cf3a717744bd849a04de4a1625c06779f90a9.tar.bz2 |
cmake: add arch_independent kwarg
CMake's write_basic_package_version_file has supported since version 3.14
an ARCH_INDEPENDENT option that makes it skip its architecture check in
the Version file.
With this patch Meson now supports it as well, and the change is also
compatible with older CMake versions, as they will simply ignore the
option.
This also slightly changes the contents of the generated Version file
when arch_independent is not set: previously, the if() needed to skip
the arch check was always filled with an empty string, while CMake puts
"FALSE" (or "TRUE") in it. Now, that if() will always be filled with
either "False" or "True", better matching CMake's behaviour.
Diffstat (limited to 'mesonbuild/modules/cmake.py')
-rw-r--r-- | mesonbuild/modules/cmake.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py index e4c85a5..73882c7 100644 --- a/mesonbuild/modules/cmake.py +++ b/mesonbuild/modules/cmake.py @@ -42,6 +42,7 @@ from ..interpreterbase import ( if T.TYPE_CHECKING: class WriteBasicPackageVersionFile(T.TypedDict): + arch_independent: bool compatibility: str install_dir: T.Optional[str] name: str @@ -270,12 +271,14 @@ class CmakeModule(ExtensionModule): @noPosargs @typed_kwargs( 'cmake.write_basic_package_version_file', + KwargInfo('arch_independent', bool, default=False, since='0.62.0'), KwargInfo('compatibility', str, default='AnyNewerVersion', validator=in_set_validator(set(COMPATIBILITIES))), KwargInfo('install_dir', (str, NoneType), default=None), KwargInfo('name', str, required=True), KwargInfo('version', str, required=True), ) def write_basic_package_version_file(self, state, args, kwargs: 'WriteBasicPackageVersionFile'): + arch_independent = kwargs['arch_independent'] compatibility = kwargs['compatibility'] name = kwargs['name'] version = kwargs['version'] @@ -296,7 +299,8 @@ class CmakeModule(ExtensionModule): conf = { 'CVF_VERSION': (version, ''), - 'CMAKE_SIZEOF_VOID_P': (str(self.detect_voidp_size(state.environment)), '') + 'CMAKE_SIZEOF_VOID_P': (str(self.detect_voidp_size(state.environment)), ''), + 'CVF_ARCH_INDEPENDENT': (arch_independent, ''), } mesonlib.do_conf_file(template_file, version_file, conf, 'meson') |