Skip to content

Commit 8cdb346

Browse files
committed
Simplify finding of dependencies in meson
1 parent e27b5a7 commit 8cdb346

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

config/meson.build

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,9 @@ elif get_option('blas') == 'custom'
5959
endif
6060

6161
# Create the tool chain library as subproject
62-
mctc_dep = dependency('mctc-lib', required: false)
63-
if not mctc_dep.found()
64-
mctc_prj = subproject(
65-
'mctc-lib',
66-
version: '>=0.2',
67-
default_options: [
68-
'default_library=static',
69-
],
70-
)
71-
mctc_dep = mctc_prj.get_variable('mctc_dep')
72-
73-
if install
74-
install_data(
75-
mctc_prj.get_variable('mctc_lic'),
76-
install_dir: get_option('datadir')/'licenses'/meson.project_name()/'mctc-lib'
77-
)
78-
endif
79-
endif
62+
mctc_dep = dependency(
63+
'mctc-lib',
64+
fallback: ['mctc-lib', 'mctc_dep'],
65+
default_options: ['default_library=static'],
66+
)
8067
lib_deps += mctc_dep

test/unit/meson.build

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@
1515
# along with s-dftd3. If not, see <https://www.gnu.org/licenses/>.
1616

1717
# Create mstore as subproject for testing
18-
mstore_prj = subproject(
18+
mstore_dep = dependency(
1919
'mstore',
20-
version: '>=0.1',
20+
fallback: ['mstore', 'mstore_dep'],
21+
default_options: ['default_library=static'],
2122
required: not meson.is_subproject(),
22-
default_options: [
23-
'default_library=static',
24-
],
2523
)
2624
# If we do not find mstore and are a subproject, we just skip testing
27-
if not mstore_prj.found()
25+
if not mstore_dep.found()
2826
subdir_done()
2927
endif
30-
mstore_dep = mstore_prj.get_variable('mstore_dep')
3128

3229
tests = [
3330
'ncoord',

0 commit comments

Comments
 (0)