CTest project directory. No tests were found
Asked Answered
A

1

6

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.

Aflame answered 4/6, 2020 at 2:49 Comment(0)
A
5

I needed to enable_testing() in ProjectMain's CMakeLists.txt

Aflame answered 5/6, 2020 at 1:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.