Skip to content

Commit 6710861

Browse files
yegorichstephane
authored andcommitted
Add an option to disable tests compilation
Signed-off-by: Yegor Yefremov <[email protected]>
1 parent 55d8e2c commit 6710861

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Makefile.am

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ CLEANFILES += libmodbus.pc
99

1010
dist_doc_DATA = MIGRATION README.md
1111

12-
SUBDIRS = src tests doc
12+
SUBDIRS = src doc
13+
14+
if BUILD_TESTS
15+
SUBDIRS += tests
16+
endif

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ my_CFLAGS="-Wall \
141141
-Wformat-security"
142142
AC_SUBST([my_CFLAGS])
143143

144+
# Build options
145+
AC_ARG_ENABLE(tests,
146+
AS_HELP_STRING([--disable-tests],
147+
[Build tests (default: yes)]),,
148+
[enable_tests=yes])
149+
AM_CONDITIONAL(BUILD_TESTS, [test $enable_tests != no])
150+
144151
AC_CONFIG_HEADERS([config.h tests/unit-test.h])
145152
AC_CONFIG_FILES([
146153
Makefile
@@ -167,4 +174,5 @@ AC_MSG_RESULT([
167174
ldflags: ${LDFLAGS}
168175
169176
documentation: ${ac_libmodbus_build_doc}
177+
tests: ${enable_tests}
170178
])

0 commit comments

Comments
 (0)