Here is my project hierarchy
ProjectMain
|
Project 1
| |
| tests
|
Project 2
|
tests
CMakeLists of ProjectMain downloads and sets up google test as per https://github.com/google/googletest/blob/master/googletest/README.md
CMakeLists of Project 1 and Project 2 have include(CTest) as well as enable_testing(). After I build everything the executables for the test sit in a similar hierarchy in the buildpath. The problem is when I use the cmake tools for VSCode to run tests it thinks the test project is ProjectMain and obviously can't find any tests. If I run cmake from the Project 1 build directory it works fine. If I move it manually to ProjectMain's build directory the cmake tools test works fine. Additionally I tried using the WORKING_DIRECTORY parameter in add_test but no luck the files stayed where they were.