mirror of
https://github.com/allankoechke/SQLiteCpp.git
synced 2026-12-04 01:17:37 +00:00
link library statically when building unit tests
make the meson file link statically the library when building the unit tests executable so it does not fail on windows as the symbols are not exported by default
This commit is contained in:
22
meson.build
22
meson.build
@@ -149,6 +149,18 @@ libsqlitecpp = library(
|
||||
# install: true,
|
||||
# API version for SQLiteCpp shared library.
|
||||
version: '0',)
|
||||
if get_option('SQLITECPP_BUILD_TESTS')
|
||||
# for the unit tests we need to link against a static version of SQLiteCpp
|
||||
libsqlitecpp_static = static_library(
|
||||
'sqlitecpp_static',
|
||||
sqlitecpp_srcs,
|
||||
include_directories: sqlitecpp_incl,
|
||||
cpp_args: sqlitecpp_args,
|
||||
dependencies: sqlitecpp_deps,
|
||||
# override the default options
|
||||
override_options: sqlitecpp_opts,)
|
||||
# static libraries do not have a version
|
||||
endif
|
||||
|
||||
install_headers(
|
||||
'include/SQLiteCpp/SQLiteCpp.h',
|
||||
@@ -167,6 +179,14 @@ sqlitecpp_dep = declare_dependency(
|
||||
include_directories: sqlitecpp_incl,
|
||||
link_with: libsqlitecpp,
|
||||
)
|
||||
if get_option('SQLITECPP_BUILD_TESTS')
|
||||
## make the dependency static so the unit tests can link against it
|
||||
## (mainly for windows as the symbols are not exported by default)
|
||||
sqlitecpp_static_dep = declare_dependency(
|
||||
include_directories: sqlitecpp_incl,
|
||||
link_with: libsqlitecpp_static,
|
||||
)
|
||||
endif
|
||||
|
||||
if get_option('SQLITECPP_BUILD_TESTS')
|
||||
gtest_dep = dependency(
|
||||
@@ -175,7 +195,7 @@ if get_option('SQLITECPP_BUILD_TESTS')
|
||||
fallback: ['gtest', 'gtest_dep'])
|
||||
sqlitecpp_test_dependencies = [
|
||||
gtest_dep,
|
||||
sqlitecpp_dep,
|
||||
sqlitecpp_static_dep,
|
||||
sqlite3_dep,
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user