Skip to content

Commit 6e9c34a

Browse files
burloghorenmar
authored andcommitted
add meson option to not install library
1 parent 7d7b2f8 commit 6e9c34a

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

meson_options.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
option('tests', type: 'boolean', value: true, description: 'Build the unit tests')
2+
option('install', type: 'boolean', value: true, description: 'Install the library')

src/catch2/meson.build

+22-15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ configure_file(
1616
format: 'cmake@',
1717
install_dir: get_option('includedir') / 'catch2',
1818
configuration: conf_data,
19+
install: get_option('install')
1920
)
2021

2122
fs = import('fs')
@@ -339,7 +340,9 @@ foreach file : headers
339340
endif
340341
endforeach
341342

342-
install_headers(file, subdir: join_paths(include_subdir, folder))
343+
if get_option('install')
344+
install_headers(file, subdir: join_paths(include_subdir, folder))
345+
endif
343346
endforeach
344347

345348
catch2_dependencies = []
@@ -356,37 +359,41 @@ catch2 = static_library(
356359
sources,
357360
dependencies: catch2_dependencies,
358361
include_directories: '..',
359-
install: true,
362+
install: get_option('install'),
360363
)
361364

362365
catch2_dep = declare_dependency(
363366
link_with: catch2,
364367
include_directories: '..',
365368
)
366369

367-
pkg.generate(
368-
catch2,
369-
filebase: 'catch2',
370-
description: 'A modern, C++-native, test framework for C++14 and above',
371-
url: 'https://github.com/catchorg/Catch2',
372-
)
370+
if get_option('install')
371+
pkg.generate(
372+
catch2,
373+
filebase: 'catch2',
374+
description: 'A modern, C++-native, test framework for C++14 and above',
375+
url: 'https://github.com/catchorg/Catch2',
376+
)
377+
endif
373378

374379
catch2_with_main = static_library(
375380
'Catch2Main',
376381
'internal/catch_main.cpp',
377382
link_with: catch2,
378383
include_directories: '..',
379-
install: true,
384+
install: get_option('install'),
380385
)
381386

382387
catch2_with_main_dep = declare_dependency(
383388
link_with: [catch2, catch2_with_main],
384389
include_directories: '..',
385390
)
386391

387-
pkg.generate(
388-
catch2_with_main,
389-
filebase: 'catch2-with-main',
390-
description: 'A modern, C++-native, test framework for C++14 and above (links in default main)',
391-
requires: 'catch2 = ' + meson.project_version(),
392-
)
392+
if get_option('install')
393+
pkg.generate(
394+
catch2_with_main,
395+
filebase: 'catch2-with-main',
396+
description: 'A modern, C++-native, test framework for C++14 and above (links in default main)',
397+
requires: 'catch2 = ' + meson.project_version(),
398+
)
399+
endif

0 commit comments

Comments
 (0)