@@ -93,6 +93,11 @@ if host_machine.system() == 'windows'
9393 sqlitecpp_opts += [
9494 ' cpp_std=c++14' ,
9595 ]
96+ # check that we are not trying to build as dynamic library
97+ if get_option (' default_library' ) != ' shared'
98+ warming(' SQLiteCpp does not support shared library on Windows, the library will be built as static' )
99+ endif
100+
96101endif
97102# Options relative to SQLite and SQLiteC++ functions
98103
@@ -139,29 +144,45 @@ if get_option('b_coverage')
139144 ]
140145endif
141146
142-
143- libsqlitecpp = library (
144- ' sqlitecpp' ,
145- sqlitecpp_srcs,
146- include_directories : sqlitecpp_incl,
147- cpp_args : sqlitecpp_args,
148- dependencies : sqlitecpp_deps,
149- # override the default options
150- override_options : sqlitecpp_opts,
151- # install: true,
152- # API version for SQLiteCpp shared library.
153- version : ' 0' ,)
154- if get_option (' SQLITECPP_BUILD_TESTS' )
155- # for the unit tests we need to link against a static version of SQLiteCpp
156- libsqlitecpp_static = static_library (
157- ' sqlitecpp_static' ,
147+ ## Workarround for windows: if building on windows we will build the library as static
148+ if host_machine .system() == ' windows'
149+ libsqlitecpp = static_library (
150+ ' sqlitecpp' ,
158151 sqlitecpp_srcs,
159152 include_directories : sqlitecpp_incl,
160153 cpp_args : sqlitecpp_args,
161154 dependencies : sqlitecpp_deps,
162155 # override the default options
163156 override_options : sqlitecpp_opts,)
164- # static libraries do not have a version
157+ else
158+ libsqlitecpp = library (
159+ ' sqlitecpp' ,
160+ sqlitecpp_srcs,
161+ include_directories : sqlitecpp_incl,
162+ cpp_args : sqlitecpp_args,
163+ dependencies : sqlitecpp_deps,
164+ # override the default options
165+ override_options : sqlitecpp_opts,
166+ # install: true,
167+ # API version for SQLiteCpp shared library.
168+ version : ' 0' ,)
169+ endif
170+
171+ if get_option (' SQLITECPP_BUILD_TESTS' )
172+ # for the unit tests we need to link against a static version of SQLiteCpp
173+ if host_machine .system() == ' windows' or get_option (' default_library' ) == ' static'
174+ # we do not need to recomplile the library
175+ libsqlitecpp_static = libsqlitecpp
176+ else
177+ libsqlitecpp_static = static_library (
178+ ' sqlitecpp_static' ,
179+ sqlitecpp_srcs,
180+ include_directories : sqlitecpp_incl,
181+ cpp_args : sqlitecpp_args,
182+ dependencies : sqlitecpp_deps,
183+ # override the default options
184+ override_options : sqlitecpp_opts,)
185+ endif
165186endif
166187
167188install_subdir (
0 commit comments