← All tasks
cppgoogle-deepmind/mujoco #382Not a task: not reproduced

CMake configuration breaks if building with MUJOCO_BUILD_TESTS=OFF

envgap__google-deepmind__mujoco-382

01 / FAILURE SIGNATURE

As reported upstream

I'm running into this issue when running the `CMake` configuration step, while using `-DMUJOCO_BUILD_TESTS=OFF`. It seems that tests are still requested for a python util via `MUJOCO_TEST_PYTHON_UTIL`, which enables testing, but it doesn't include `googletest`, therefore throwing an error during configuration, as shown in the screenshot below:
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
c9ec2654a22d099c07efc9e3cfb3e617b11f2acb
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

google-deepmind/mujoco #382 · read the original issue
Hi there.



I'm running into this issue when running the `CMake` configuration step, while using `-DMUJOCO_BUILD_TESTS=OFF`. It seems that tests are still requested for a python util via `MUJOCO_TEST_PYTHON_UTIL`, which enables testing, but it doesn't include `googletest`, therefore throwing an error during configuration, as shown in the screenshot below:



```bash

# CMake configuration with tests disabled

cmake -B build -DMUJOCO_BUILD_TESTS=OFF

```



![img_mujoco_issue_build_with_no_tests](https://user-images.githubusercontent.com/26859929/179073983-ae853f39-3099-4761-93ec-542f0bf42946.png)



Notice that [here][0] `GoogleTest` is being included, but it's not included [here][1] for that python util (yet, `gtest_add_test` is being called without having `GoogleTest` included)



A fix would be to check for `MUJOCO_BUILD_TESTS` also on the following line on the root [`CMakeLists.txt`][2]:



![img_mujoco_issue_build_with_no_tests_snippet](https://user-images.githubusercontent.com/26859929/179076003-5e0d269b-8c2d-44e6-b31c-8ee423b251d3.png)



This works, but I'm not 100% sure what is the expected behaviour for this case. If that's the expected behaviour, I could write a small PR with this fix.



- **OS:** `Arch Linux`

- **MuJoCo version:** `2.2.0`



[0]: <https://github.com/deepmind/mujoco/blob/af12322e9d6fe1b5a7b59fe6eb4dc3f790f35580/test/CMakeLists.txt#L18> (tests-cmakefile)

[1]: <https://github.com/deepmind/mujoco/blob/af12322e9d6fe1b5a7b59fe6eb4dc3f790f35580/python/mujoco/util/CMakeLists.txt#L61> (tests-python-util-cmakefile)

[2]: <https://github.com/deepmind/mujoco/blob/af12322e9d6fe1b5a7b59fe6eb4dc3f790f35580/CMakeLists.txt#L164> (root-cmakefile)
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]