Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR, all instances of
mujoco_test
in the codebase were followed by a call totarget_link_libraries(<testname> fixture gmock)
.As anyhow
mujoco_test
already was calling target_link_libraries to some predefined list of targets (mujoco
andgtest_main
), this PR adds to the list of default linked targets alsofixture
andgmock
, to reduce the boilerplate required to add a test.Furthermore, to completely remove the need for calling target_link_libraries after a call to
mujoco_test
, this PR also adds to themujoco_test
macro theADDITIONAL_LINK_LIBRARIES
argument, that can be used if a given test needs to link some additional targets beside the default ones.To permit to use these new features also for mujoco benchmarks, this PR adds a
MAIN_TARGET
parameter to mujoco_test, to select ifgtest_main
or another target is used to provide the mainentry point to the test executable, and migrate the existing usage of
mujoco_benchmark_test
to usemujoco_test
.This change is a requirement to add a
TAGS
argument to themujoco_test
macro, to permit to skip the compilation of a given test under some condition.