Skip to content

I lost over a day trying to figure out why I couldn't set a working directory...

Stuart Schechter requested to merge UppaJung/modern-cmake:patch-1 into master

I lost over a day trying to figure out why I couldn't set a working directory for tests. It turns out, you can't (at least for Visual Studio projects) if you used gtest_add_tests, but it works just fine using the more up to date gtest_discover_tests. This PR is written to facilitate two very common needs of testers: access to a working directory and the ability to include libraries (since, tests are often written to tests libraries.)

Changes: Replace gtest_add_tests, which is outdated and causes problems (especially in Windows & visual studio) with gtest_discover_tests. Modified macros to show how working directories are set Add example that sets working directory and uses custom libraries. Add include(GoogleTest), which seems to be necessary on some platforms

Merge request reports