cmake has a special variable ```BUILD_TESTING``` for this purpose, see [here](https://cmake.org/cmake/help/book/mastering-cmake/chapter/Testing%20With%20CMake%20and%20CTest.html). Building/running tests unconditionally during build isn't desired. Port frameworks have a special option to run tests after build when configured by admins.