modules/cmake: Fix setting install_dir

Fixes: #7301
pull/7309/head
Dylan Baker 5 years ago committed by Nirbheek Chauhan
parent 0332d7e350
commit 49a974213c
  1. 3
      mesonbuild/modules/cmake.py
  2. 1
      test cases/cmake/19 cmake file/foolib.cmake.in
  3. 14
      test cases/cmake/19 cmake file/meson.build
  4. 5
      test cases/cmake/19 cmake file/test.json

@ -252,8 +252,7 @@ class CmakeModule(ExtensionModule):
(ofile_path, ofile_fname) = os.path.split(os.path.join(state.subdir, '{}Config.cmake'.format(name)))
ofile_abs = os.path.join(state.environment.build_dir, ofile_path, ofile_fname)
if 'install_dir' not in kwargs:
install_dir = os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'cmake', name)
install_dir = kwargs.get('install_dir', os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'cmake', name))
if not isinstance(install_dir, str):
raise mesonlib.MesonException('"install_dir" must be a string.')

@ -0,0 +1,14 @@
project(
'cmake config file',
)
cmake = import('cmake')
cmake_conf = configuration_data()
cmake_conf.set_quoted('foo', 'bar')
cmake.configure_package_config_file(
name : 'foolib',
input : 'foolib.cmake.in',
install_dir : get_option('libdir') / 'cmake',
configuration : cmake_conf,
)

@ -0,0 +1,5 @@
{
"installed": [
{"file": "usr/lib/cmake/foolibConfig.cmake", "type": "file"}
]
}
Loading…
Cancel
Save