Merge pull request #14 from shdnx/master

Better support for including as subproject (resolves #11)
This commit is contained in:
Mark Gillard 2020-03-04 17:54:27 +02:00 committed by GitHub
commit e775df5197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -11,7 +11,6 @@ project(
]
)
compiler = meson.get_compiler('cpp')
message(['compiler ID: ', compiler.get_id()])
@ -73,7 +72,23 @@ compiler_supports_char8_strings = compiler.compiles('''
args : [ '-std=c++2a' ]
)
inc = include_directories(['include', 'extern'])
tomlplusplus_dep = declare_dependency(
include_directories : include_directories('include'),
version : meson.project_version(),
)
build_tests = false
if get_option('BUILD_TESTS').auto()
build_tests = (not meson.is_subproject())
else
build_tests = get_option('BUILD_TESTS').enabled()
endif
if build_tests
inc = include_directories('include', 'extern')
subdir('tests')
else
message('Not building tests')
endif
subdir('tests')
# subdir('examples')

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('BUILD_TESTS', type : 'feature', value : 'auto', description : 'Whether to build tests (defaults to auto: only if not a subproject)')