Visual Studio 2017 has integrated C++ unit testing (native, google test, ctest, etc.). How can I create a CMakeLists.txt file that will create a project like this that will use the integrated IDE testing, for example using either google test or the native microsoft unit testing framework? All of Microsoft's examples unfortunately just create the project in Visual Studio, rather than starting from a CMake file.
Any help is appreciated, thanks!
Mikewho,
I setup a small example using Google Test project that works with integrated IDE testing.
Create an empty directory and save these two files:
CMakeLists.txt
tests.cpp
The in a command prompt type
Note: I had vcpkg install gtest
Make sure you have this installed in Visual Studio 2017
In Tools > Options > Test Adapter for Google Test set the regex to .exe
Build the solution and press Run all in the Test Explorer
The first time it runs it will find the test case
I hope this helps?