Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use OpenCV's test framework with CMake?

It seems like OpenCV has a test framework based on GTest. They use it for their own unit tests, but I can not find documentation, examples or tutorials on how to use it outside of OpenCV.

It would be a perfect fit for the tests I intend to implement on our OpenCV-based library, but I do not really know where to start, as I am not really an expert in CMake (which builds our library).

I would very much appreciate help on the setup of some kind of "Hello ts World", i.e. how to configure the main CMakeList.txt and the one in the test directory in order to run tests like the ones found in the modules's test subdirectoriess (e.g. core's test folder)

like image 317
user981733 Avatar asked Oct 16 '13 14:10

user981733


People also ask

How do I add a test to CMake?

To add testing to a CMake-based project, simply include(CTest) and use the add_test command.

What is CMake OpenCV?

CMake is an open-source, cross-platform family of tools designed to build, test and package software. We have CMake installed now. Let's build a C++ Hello World program using CMake .


1 Answers

After some research and tests, I answered my own question in my blog : Using OpenCV's test framework (with CMake)

Again, I'm no CMake expert, so comments are welcome!

like image 112
user981733 Avatar answered Oct 04 '22 13:10

user981733