Run tests before build
Completed
Hello,
I have a shared library project with 2 configurations Debug | Release. I have also implemented google tests. When the configuration is Release I would like to run some tests (or all) before the build. Also it would be nice to check if all the tests passed and then start/continue the build. Is this possible? If so how?
Please sign in to leave a comment.
What about cmake's add_custom_target or add_custom_command?
Thank you Shkodnikpavel. After your suggestion I managed to do it. Here is what I did:
In my main CMakeLists.txt I have this:
The
add_custom_command()is smart therefore when the tests executable doesn't return 0 (all test have passed successfully) the build will fail and the library will not be build.You are winner, Xlahvi00.