Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson option to not install the library #2940

Merged
merged 3 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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