I created a command-line portable script-based industrialized agnostic build system useful to quickly build several dependent projects while not having to rely on a particular IDE or a build factory. It's agnostic, because it's not based on a single build engine. I founded the first version using cmake, because my projects are mostly C++, but that'll evolve (to include gradle for example or whatever). That's to say, I'm not centered on CMake, it's merely a tool to a goal, easy portable C++ project building. I had BJam in mind formerly and would have kept it if there had been more documentation.
As a result though, I'm very dependent on CMake to perform the build and unit tests. As of today, I realized that tests are built under the 'all' target and run under the 'test' target.
With CMake 2- (and -here for example- a Unix Makefiles generator):
make all # Build project AND tests
make test # Run tests
With CMake 3+ and any generator:
cmake --build . --target all # Build project AND tests
cmake --build . --target test # Run tests
I'd like to know if someone would know a way to split the 'build project' phase apart from the 'build tests' phase (also because it's feels more natural in my build system to join test building and running tests than the other way around).
Important precision: I don't want to bootstrap the project with one vision or another (by flipping BUILD_TESTING). The idea would be to have 3 stages like:
cmake --build . --target <project> # 1. Build project only
cmake --build . --target <build_tests> # 2. Build tests
cmake --build . --target <run_tests> # 3. Run tests
If I choose not to run tests, I could go straight from phase 1 above to installing, but running phase 3 would trigger the previous dependent phases.
Any clue? (If not, I suspect I'll have to ask CMake developers directly...)
Thanks in advance. Regards.
Aucun commentaire:
Enregistrer un commentaire