After some research, I came up with a suitable way to handle unit tests and Automake:
Following the previous pattern:
./ + tests/ + Makefile.am + classA_test.cc .... + classB_test.cc + src/ + lib/ + Makefile.am
Makefile.am will be the main root, this one calls the makefile in the test directory
$ cat Makefile.am SUBDIRS = . tests
Now if you want to run tests
$ sh ../pathto/configure $ make check
In addition, dist [check] should work
$ make distcheck ... make[3]: Entering directory `/home/vicente/test/tests' PASS: settings ============================================================================ Testsuite summary for Pepinos 00.13.15 ============================================================================ # TOTAL: 1 # PASS: 1 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[3]: Leaving directory `/home/vicente/test/tests' ...
So, to answer another question?
Q. I cannot export my variables - such as AM_CPPFLAGS-- to another Makefile.
a. True, but I can always declare a variable in configure.ac and AC_SUBT to make it visible to another Makefile.am
Sources: fooobar.com/questions/944043 / ...
source share