[CMake] Establishing TDD workflow
info at eskosoft.com
Sun Nov 30 06:38:20 EST 2008
I'm only starting with cmake, so my question can be quite lame.
However, I have read the "Mastering Cmake" and googled a lot about it
I have executable running the tests built with cmake. Now I need to
execute it as a part of build process.
I'm building the exec with the following:
add_executable(ut TestUnittest.cpp stdafx.cpp SomeSuite.cpp SecondSuite.cpp)
In the search for solution I have tried two approaches:
add_custom_command(TARGET ut POST_BUILD COMMAND ut COMMENT Testing)
As a result, command runs after succesfull build. Problem here is if
the test fails, they are not runs again after next build (since the
executable is not changed and rebuild). But I need it to run each
build until the tests are succesfull.
2. When I add
add_custom_target(ut_test ALL DEPENDS ut COMMAND ut)
The tests starts running all time, even if previous run was successful
and the exec was not rebuilt. If I'm not adding "ALL", it is not
running at all.
It's ok for now, but it unacceptable in the long term.
So, to sum up, what I need:
1. If exec dependencies was changed, rebuild exec
2. If exec was changed, run exec. If exec was not changed, but last
exec run was failed, run exec. If exec was not changed and exec
during last built was successful, don't run exec.
I suspect, I shall rewrite the exec so it shall output some file in
the case of succesfull run so I can add something in the filesystem
for cmake to look for.
People, please help me!
Slava mailto:info at eskosoft.com
More information about the CMake