Skip to content

Commit

Permalink
modules/cmake: Fix setting install_dir
Browse files Browse the repository at this point in the history
Fixes: #7301
  • Loading branch information
dcbaker authored and nirbheek committed Jun 13, 2020
1 parent fd1b8b1 commit 02f6fbd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions mesonbuild/modules/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ def configure_package_config_file(self, interpreter, state, args, kwargs):
(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.')

Expand Down
1 change: 1 addition & 0 deletions test cases/cmake/19 cmake file/foolib.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@foo@
14 changes: 14 additions & 0 deletions test cases/cmake/19 cmake file/meson.build
Original file line number Diff line number Diff line change
@@ -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,
)
5 changes: 5 additions & 0 deletions test cases/cmake/19 cmake file/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"installed": [
{"file": "usr/lib/cmake/foolibConfig.cmake", "type": "file"}
]
}

0 comments on commit 02f6fbd

Please sign in to comment.