Skip to content

Commit 241dac3

Browse files
committed
Only get odbc_config cflags and lflags if the program exists
1 parent bd12a6e commit 241dac3

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

meson.build

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ add_project_arguments(
3838
language: 'cpp'
3939
)
4040

41+
odbc_config = find_program('odbc_config', required : false)
42+
43+
odbc_cflags = []
44+
odbc_lflags = []
45+
if odbc_config.found()
46+
odbc_cflags = run_command([odbc_config, '--cflags'], check : true).stdout().strip()
47+
odbc_lflags = run_command([odbc_config, '--libs'], check : true).stdout().strip()
48+
endif
49+
4150
# Build the npyodbc module
4251
python.extension_module(
4352
'npyodbc',
@@ -51,6 +60,6 @@ python.extension_module(
5160
],
5261
include_directories : [npyodbc_inc],
5362
install : true,
54-
cpp_args : run_command(['odbc_config', '--cflags'], check : true).stdout().strip(),
55-
link_args : run_command(['odbc_config', '--libs'], check : true).stdout().strip(),
63+
cpp_args : odbc_cflags,
64+
link_args : odbc_lflags,
5665
)

0 commit comments

Comments
 (0)