Răsfoiți Sursa

Add an option to disable tests compilation

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Yegor Yefremov 9 ani în urmă
părinte
comite
671086111c
2 a modificat fișierele cu 13 adăugiri și 1 ștergeri
  1. 5 1
      Makefile.am
  2. 8 0
      configure.ac

+ 5 - 1
Makefile.am

@@ -9,4 +9,8 @@ CLEANFILES += libmodbus.pc
 
 dist_doc_DATA = MIGRATION README.md
 
-SUBDIRS = src tests doc
+SUBDIRS = src doc
+
+if BUILD_TESTS
+SUBDIRS += tests
+endif

+ 8 - 0
configure.ac

@@ -141,6 +141,13 @@ my_CFLAGS="-Wall \
 -Wformat-security"
 AC_SUBST([my_CFLAGS])
 
+# Build options
+AC_ARG_ENABLE(tests,
+	AS_HELP_STRING([--disable-tests],
+	[Build tests (default: yes)]),,
+	[enable_tests=yes])
+AM_CONDITIONAL(BUILD_TESTS, [test $enable_tests != no])
+
 AC_CONFIG_HEADERS([config.h tests/unit-test.h])
 AC_CONFIG_FILES([
         Makefile
@@ -167,4 +174,5 @@ AC_MSG_RESULT([
         ldflags:                ${LDFLAGS}
 
         documentation:          ${ac_libmodbus_build_doc}
+        tests:                  ${enable_tests}
 ])