Hi,

Is there a make, cmake, or ctest way to rebuild the dependencies of a
test if needed, and then run the test?

Suppose I have a bulit directory and I'm developing.  I want to make
edits, then run a command specifying one test to check, so that
anything needed by that test gets rebuilt (if my changes require it),
and then run.

In make, I would do this by having one rule like

run_%: %
    ./$<

so that if I want to edit some library's source file and then run
test_foobar, I would just run `make run_test_foobar`, and the source I
changed would get recompiled, the library would get relinked,
test_foobar would get relinked if it's static, and then test_foobar
would be run.

I hoped ctest --bulid-and-test would help, but it seems it doesn't.  I
tried --build-target test_foobar (I have add_test(test_foobar ...) in
my configuration), and it only built test_foobar, it didn't seem to
run it.

-- 
Cheers,
Leif
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to