diff options
author | Andrea Pappacoda <[email protected]> | 2021-10-05 10:17:06 +0200 |
---|---|---|
committer | Andrea Pappacoda <[email protected]> | 2021-10-05 10:22:33 +0200 |
commit | 345de8a5414fec432a773d9c2f7644f8be410a1b (patch) | |
tree | ce75fb7a2691b6f5326fa67e86f3555069dd9cc2 /meson.build | |
parent | e831805cc034d46740ec12b18d00cb015aafe7e2 (diff) | |
download | xbyak-345de8a5414fec432a773d9c2f7644f8be410a1b.tar.gz xbyak-345de8a5414fec432a773d9c2f7644f8be410a1b.zip |
build(meson): generate CMake package config files
The cmake/config.cmake.in file uses the 'install(EXPORT)` CMake feature,
that is not (yet?) supported by Meson (see
https://github.com/mesonbuild/meson/issues/7632#issuecomment-704932266).
To work around this issue I created a simple CMake config file that
defines a single IMPORTED target.
It is really basic, but since xbyak is a header-only library defining a
single target works without issues.
This is useful because with this feature when building the library using
Meson, CMake users will be able to still use `find_package(xbyak)`, and
are not forced to use the FindPkgConfig module
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 205d378..59d0051 100644 --- a/meson.build +++ b/meson.build @@ -15,12 +15,30 @@ install_subdir('xbyak', install_dir: get_option('includedir')) xbyak_dep = declare_dependency(include_directories: include_directories('.')) if meson.version().version_compare('>=0.54.0') - meson.override_dependency('xbyak', xbyak_dep) + meson.override_dependency(meson.project_name(), xbyak_dep) endif import('pkgconfig').generate( - name: 'xbyak', + name: meson.project_name(), description: 'JIT assembler for x86(IA32), x64(AMD64, x86-64)', version: meson.project_version(), url: 'https://github.com/herumi/xbyak' ) + +if meson.version().version_compare('>=0.50.0') + cmake = import('cmake') + + cmake.write_basic_package_version_file( + name: meson.project_name(), + version: meson.project_version() + ) + + cmake_conf = configuration_data() + cmake_conf.set('TARGET_NAME', meson.project_name() + '::' + meson.project_name()) + + cmake.configure_package_config_file( + name: meson.project_name(), + input: 'cmake'/'meson-config.cmake.in', + configuration: cmake_conf + ) +endif |