<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>I need to design a test (= a bash script) such that :</div><div>1) run a dedicated executable for the test (to be compiled)</div><div> 2) diff the run output with a reference log file<br></div><div><br></div><div>The test is created with : add_test(mytest ./mytest.sh). The bash script would look like:<br></div><div>>> more mytest.sh<br></div><div>/path/to/mytestexe > out.log<br></div><div>diff out.log out.ref<br></div><div><br></div><div>The dedicated executable for the test is created with : add_executable(mytestexe mytestexe.cpp)<br></div><div><br></div><div>Ideally, I would like mytestexe to be compiled when I type "make test" (before to run the test) but not "make".<br></div><div><br></div><div>Seems impossible to add a dependencie with : add_dependencies(mytest mytestexe). I googled this and found <a href="https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests">https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests</a> but this was not really clear to me...I added : add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS mytestexe).<br></div><div><br></div><div>The 2 unexpected problems I have left are:<br></div><div>1) mytestexe is compiled everytime I type "make" which is a solution but is not really what I am looking for (also compiled when I type "make check" which is expected).</div><div>    => is there a way for make not to compile mytestexe (note I didn't added ALL in add_custom_target so I am not sure to know why make builds mytestexe)<br></div><div>2) Also the verbosity is broken with check : make test ARGS="-V" is verbose , but, make check ARGS="-V" is not.<br></div><div>    => how to deal with that ?<br></div></div></body></html>