title: cmake - Using --build-and-test on add_test to build an executale
body: <p>I am asking this to verify that my code is implemented correctly. If it is, then that more than likely means that my library linkage is incorrect at some point, which narrows down the problem. I'm getting the following errors upon trying to build my test using <code>make t1</code>:</p>
  
  <pre><code>make[3]: *** No rule to make target `/home/esias/VL3/modular2/vlMain/test', needed by `vlMain/CMakeFiles/t1'.  Stop.
  make[2]: *** [vlMain/CMakeFiles/t1.dir/all] Error 2
  make[1]: *** [vlMain/CMakeFiles/t1.dir/rule] Error 2
  </code></pre>
  
  <p>Suppose I would like to build executable "exec1" and test it. Ideally, this is done by tagging the executable to a target and running <code>make &lt;target&gt;</code> - please correct me if I'm wrong. </p>
  
  <p>As far as I am aware, this is done by using the --build-and-test argument on add_test. This is the code I am using:</p>
  
  <pre><code>  ADD_TEST(test1 exec1
      --build-two-config
      --build-and-test
      "${CMAKE_SOURCE_DIR}/vlMain/vlMPIMain.cpp" #source to create from?
      "${CMAKE_BINARY_DIR}/Tests/exec1" #output folder?
      ) 
  
    add_custom_target(t1 COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test1)
  
    TARGET_LINK_LIBRARIES(t1
       ${GLEW_LIBRARY}
       vlapp
       vlrender
       vldm
       )
  </code></pre>
  
  <p>I would like to build an executable called "exec1" using <code>${CMAKE_SOURCE_DIR}/vlMain/vlMPIMain.cpp</code> as source code, and put it into <code>${CMAKE_BINARY_DIR}/Tests/exec1</code> Then I would like to link a couple of libraries to it. </p>
  
  <p>Is my implementation correct? Can it be improved? </p>
  
  <p>Thanks. </p>