GoogleTest: gtest_discover_tests doesn't pass ENVIRONMENT property to execute_process() call to discover the tests
In GoogleTestAddTests.cmake there is an execute_process
call used to discover the tests. This call however doesn't honor the PROPERTIES passed in when calling gtest_discover_tests
e.g.
gtest_discover_tests(Foo
PROPERTIES ENVIRONMENT "BAR=1" # this won't get passed to that call
)
In my case for example, I need to set an environment variable that is necessary (otherwise the executable won't even start properly) even for test discovery and I don't see a way to do so without setting it for everything else and that's undesirable.
In case anyone is curious, the environment variable I need to set up is ASAN_WIN_CONTINUE_ON_INTERCEPTION_FAILURE , with this variable unset, the test runner will fail to start with STATUS_DLL_INIT_FAILED, making my whole build process fail. This is due to a bug in LLVM which is fixed in trunk (but not released yet) but will not get backported so I will need a way to reliably set this environment variable and possibly others.