Simplest example of using Google C++ Testing Framework with CMake
I have a very simple C++ library (one header file, one .cpp file). I want to write unit tests for this project using the Google C++ Testing Framework. Here is the directory structure: ~/project1 | |-- project1.cpp |-- project1.h |-- project1_unittests.cpp \-- CMakeLists.txt I do not plan to write my own main() function. I want to link with gtest_main as mentioned in the primer . What should CMakeLists.txt contain? Enable CMake's built-in testing subsystem: # For make-based builds, defines make target named test. # For Visual Studio builds, defines Visual Studio project named RUN_TESTS. enable