aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2021-10-06 16:25:00 +0900
committerGitHub <[email protected]>2021-10-06 16:25:00 +0900
commitcecd204a506a723950932629bff2dff35f0ebe84 (patch)
treece75fb7a2691b6f5326fa67e86f3555069dd9cc2
parente831805cc034d46740ec12b18d00cb015aafe7e2 (diff)
parent345de8a5414fec432a773d9c2f7644f8be410a1b (diff)
downloadxbyak-cecd204a506a723950932629bff2dff35f0ebe84.tar.gz
xbyak-cecd204a506a723950932629bff2dff35f0ebe84.zip
Merge pull request #129 from Tachi107/meson-cmake-config
build(meson): generate CMake package config files
-rw-r--r--cmake/meson-config.cmake.in8
-rw-r--r--meson.build22
2 files changed, 28 insertions, 2 deletions
diff --git a/cmake/meson-config.cmake.in b/cmake/meson-config.cmake.in
new file mode 100644
index 0000000..9aeef78
--- /dev/null
+++ b/cmake/meson-config.cmake.in
@@ -0,0 +1,8 @@
+@PACKAGE_INIT@
+
+if(NOT TARGET @TARGET_NAME@)
+ add_library(@TARGET_NAME@ INTERFACE IMPORTED)
+ set_target_properties(@TARGET_NAME@ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_FILE}/include"
+ )
+endif()
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