mercredi 1 novembre 2017

CMake - Automatically build test executable and find dependencies

I have a problem which can be solved in different ways but before starting writing any solutions I wanted to ask your opinion on the subject.

I have a server with a huge code base and since testing is non-existent I wanted to write some tests for it.

The idea is to split different test suites into different executable. So one test file will basically cover a single module.

I also want to automatically build one executable per test file.

Now I could recursively loop over all the files, remove the .cpp extension and add a new executable with the same name as the file. The problem is that I need to include the hpp/cpp files from the server into the executable as well since it is a dependency.

Is there a way I could automatically detect dependencies and add them to the test executable?

Adding all the files for every single executable takes months to compile.

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire