Skip to content

Commit

Permalink
add meson option to not install library
Browse files Browse the repository at this point in the history
  • Loading branch information
burlog authored and horenmar committed Jan 5, 2025
1 parent 7d7b2f8 commit 6e9c34a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('tests', type: 'boolean', value: true, description: 'Build the unit tests')
option('install', type: 'boolean', value: true, description: 'Install the library')
37 changes: 22 additions & 15 deletions src/catch2/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ configure_file(
format: 'cmake@',
install_dir: get_option('includedir') / 'catch2',
configuration: conf_data,
install: get_option('install')
)

fs = import('fs')
Expand Down Expand Up @@ -339,7 +340,9 @@ foreach file : headers
endif
endforeach

install_headers(file, subdir: join_paths(include_subdir, folder))
if get_option('install')
install_headers(file, subdir: join_paths(include_subdir, folder))
endif
endforeach

catch2_dependencies = []
Expand All @@ -356,37 +359,41 @@ catch2 = static_library(
sources,
dependencies: catch2_dependencies,
include_directories: '..',
install: true,
install: get_option('install'),
)

catch2_dep = declare_dependency(
link_with: catch2,
include_directories: '..',
)

pkg.generate(
catch2,
filebase: 'catch2',
description: 'A modern, C++-native, test framework for C++14 and above',
url: 'https://github.com/catchorg/Catch2',
)
if get_option('install')
pkg.generate(
catch2,
filebase: 'catch2',
description: 'A modern, C++-native, test framework for C++14 and above',
url: 'https://github.com/catchorg/Catch2',
)
endif

catch2_with_main = static_library(
'Catch2Main',
'internal/catch_main.cpp',
link_with: catch2,
include_directories: '..',
install: true,
install: get_option('install'),
)

catch2_with_main_dep = declare_dependency(
link_with: [catch2, catch2_with_main],
include_directories: '..',
)

pkg.generate(
catch2_with_main,
filebase: 'catch2-with-main',
description: 'A modern, C++-native, test framework for C++14 and above (links in default main)',
requires: 'catch2 = ' + meson.project_version(),
)
if get_option('install')
pkg.generate(
catch2_with_main,
filebase: 'catch2-with-main',
description: 'A modern, C++-native, test framework for C++14 and above (links in default main)',
requires: 'catch2 = ' + meson.project_version(),
)
endif

0 comments on commit 6e9c34a

Please sign in to comment.