Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative header paths in the CMake config #855

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonas-eschmann
Copy link
Contributor

When using MuJoCo by including it as a git submodule and including it into the build configuration via add_subdirectory I ran into the issue that cmake --install . would stop to function because a MuJoCo header could not be found:

CMake Error at cmake_install.cmake:61 (file):
  file INSTALL cannot find
  "/Users/jonas/my_project_dir/include/mujoco/mjdata.h": No such
  file or directory.

The actual path should be /Users/jonas/my_project_dir/external/mujoco/include/mujoco/mjdata.h.

I fixed this by making the MUJOCO_HEADERS relative to the CMakeLists.txt by using CMAKE_CURRENT_SOURCE_DIR. I'm not sure if it would be a better practice to use CMAKE_CURRENT_PROJECT_DIR in this case but I think it shouldn't make a difference in the end because the current project (mujoco) is defined in the same CMakeLists.txt. A priori this change should not have any side effects when not building mujoco as a subdirectory but standalone and a posteriori it still built and installed fine when used standalone.

…o is included in a project as a subdirectory)
@jonas-eschmann
Copy link
Contributor Author

PS: For the same use case (using MuJoCo as a subdirectory) it would also be great if the cmake --install behavior could be completely disabled through e.g. a flag. I tried to turn it off using EXCLUDE_FROM_ALL but that didn't have an effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants