title: Unit tests using Automake
body: <p>I am working in a project with other people in the team using GNU autotools. In the project we are using unit test for each non trivial C++ class. I found out that there is support for unit testing. For that I am using this structure:</p>
  
  <pre><code> ./
     + tests/
       + Makefile.am
       + classA_test.cc
       ....
       + classB_test.cc
     + src/
     + lib/
     + Makefile.am 
  </code></pre>
  
  <p>The problem comes since my main Makefile.am is using <em>subdir-objects</em> options --note that I am not using recursive makefile for the source files--, I cannot export my variables --such as, AM_CPPFLAGS-- to the other Makefile. So far I made it work using:</p>
  
  <pre><code>  $ make check      
  </code></pre>
  
  <p>but I keep getting problems for the paths and the options when I do </p>
  
  <pre><code>  $ make distcheck
  </code></pre>
  
  <p>So my questions is, how is the standard way to deal with unit tests? </p>
  
  <p>EDIT:</p>
  
  <p>I made it work as long as I remove the subdir-objects from the tests/Makefile.am. Now it throw some warnings but it compiles. Still it seems not to be an appropriate way to deal with unit tests</p>