Skip to content

Commit c1b9420

Browse files
committed
add missing compile options
1 parent 8e00fef commit c1b9420

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

meson.build

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ unix_like_code = '''
2020
'''
2121
unix_like = cxx.compiles(unix_like_code, name : 'unix like environment')
2222

23-
## C++17 disable the support for std::filesystem (by default off)
24-
if get_option('SQLITECPP_DISABLE_STD_FILESYSTEM')
25-
sqlitecpp_cxx_flags += ['-DSQLITECPP_DISABLE_STD_FILESYSTEM']
26-
endif
23+
mingw_64_env_code = '''
24+
#if defined(__MINGW64__)
25+
// do nothing
26+
#else
27+
# error "Non MinGW-W64 environment"
28+
#endif
29+
'''
30+
mingw_64_env = cxx.compiles(mingw_64_env_code, name : 'MinGW-W64 environment')
2731

2832
thread_dep = dependency('threads')
2933
# sqlite3 support
@@ -130,6 +134,29 @@ if get_option('SQLITE_USE_LEGACY_STRUCT')
130134
]
131135
endif
132136

137+
## C++17 disable the support for std::filesystem (by default off)
138+
if get_option('SQLITECPP_DISABLE_STD_FILESYSTEM')
139+
sqlitecpp_cxx_flags += ['-DSQLITECPP_DISABLE_STD_FILESYSTEM']
140+
endif
141+
142+
## stack protection hardening
143+
if get_option('SQLITECPP_USE_STACK_PROTECTOR')
144+
## if is on MinGW-W64 give a warning that is not supported
145+
if mingw_64_env
146+
warning('SQLiteCpp does not support stack protection on MinGW-W64')
147+
warming('this could lead to a crash on the application')
148+
warming('you can disable this warning by setting SQLITECPP_USE_STACK_PROTECTOR to false')
149+
else
150+
sqlitecpp_args += ['-fstack-protector']
151+
endif
152+
endif
153+
154+
## enable ommit load extension
155+
if get_option('SQLITECPP_OMIT_LOAD_EXTENSION')
156+
sqlitecpp_args += ['-DSQLITE_OMIT_LOAD_EXTENSION']
157+
endif
158+
159+
133160
if unix_like
134161
sqlitecpp_args += [
135162
'-DfPIC',

meson_options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ option('SQLITE_ENABLE_ASSERT_HANDLER', type: 'boolean', value: false, descriptio
99
option('SQLITE_HAS_CODEC', type: 'boolean', value: false, description: 'Enable database encryption API. Not available in the public release of SQLite.')
1010
## Force forward declaration of legacy struct sqlite3_value (pre SQLite 3.19)
1111
option('SQLITE_USE_LEGACY_STRUCT', type: 'boolean', value: false, description: 'Fallback to forward declaration of legacy struct sqlite3_value (pre SQLite 3.19)')
12+
## Enable ommit load extension
13+
option('SQLITE_OMMIT_LOAD_EXTENSION', type: 'boolean', value: false, description: 'Enable ommit load extension.')
1214
## Disable the support for std::filesystem (C++17)
1315
option('SQLITECPP_DISABLE_STD_FILESYSTEM', type: 'boolean', value: false, description: 'Disable the support for std::filesystem (C++17)')
16+
## Stack protection is not supported on MinGW-W64 on Windows, allow this flag to be turned off.
17+
option('SQLITECPP_USE_STACK_PROTECTION', type: 'boolean', value: true, description: 'Disable stack protection on MinGW-W64 on Windows.')
1418
## Enable build for the tests of SQLiteC++
1519
option('SQLITECPP_BUILD_TESTS', type: 'boolean', value: false, description: 'Build SQLiteC++ unit tests.')
1620
## Build the examples of SQLiteC++

0 commit comments

Comments
 (0)