xctest_add_test should run `xcodebuild test` instead of `xctest`
Let's say we create a minimal example using xctest_add_test
, for example
xctest_add_bundle(test mylibrary)
xctest_add_test(Alltests test test.cpp)
and run ctest
via cmake --build . --target RUN_TESTS
, investigating Testing/Temporary/LastTest.log
will show that the test command generated by cmake is /Applications/Xcode.app/Contents/Developer/usr/bin/xctest /Users/jason/minimal/build/Debug/test.xctest
. However, directly running the xctest
tool will only work for simple scenarios, it won't execute correctly when dyld search path environment variables such as DYLD_FRAMEWORK_PATH
or DYLD_LIBRARY_PATH
are needed. On the other hand, if the test command generated by cmake is xcodebuild test -project minimal.xcodeproj -scheme mylibrary
, the test would've execute correctly because dyld search path environment variables such as DYLD_FRAMEWORK_PATH
or DYLD_LIBRARY_PATH
will be provided to the test runner.
Can we fix xctest_add_test
so that it runs xcodebuild test
instead of xctest
?