Use the if_found feature for subdir()

This commit is contained in:
King_DuckZ 2020-08-27 16:08:06 +01:00
parent be1a19f7c7
commit 2c36e6794e
2 changed files with 4 additions and 8 deletions

View file

@ -1,7 +1,7 @@
conf = configuration_data()
cpp = meson.get_compiler('cpp')
conf.set('RESTC_CPP_WITH_UNIT_TESTS', unit_tests_enabled)
conf.set('RESTC_CPP_WITH_UNIT_TESTS', boost_test_dep.found())
conf.set('RESTC_CPP_WITH_TLS', get_option('restc_cpp_with_tls') ? 1 : false)
conf.set('RESTC_CPP_LOG_WITH_BOOST_LOG', get_option('restc_cpp_log_with_boost_log') ? 1 : false)
conf.set('RESTC_CPP_WITH_ZLIB', get_option('restc_cpp_with_zlib') ? 1 : false)

View file

@ -37,10 +37,8 @@ pub_incdir = include_directories('restc-cpp/include', 'include')
if not get_option('tests').disabled()
#libs required by unit tests only here
boost_test_dep = dependency('boost', modules: ['log'], required: get_option('tests'))
unit_tests_enabled = boost_test_dep.found()
else
unit_tests_enabled = false
boost_test_dep = disabler()
endif
subdir('include/restc-cpp')
@ -82,7 +80,5 @@ restc_cpp_dep = declare_dependency(
dependencies: [tls_dep, thread_dep, boost_dep],
)
if unit_tests_enabled
lest_inc = include_directories('subprojects/lest/include')
subdir('tests')
endif
lest_inc = include_directories('subprojects/lest/include')
subdir('tests', if_found: boost_test_dep)