Relative header paths in the CMake config #855
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.
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: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 theCMakeLists.txt
by usingCMAKE_CURRENT_SOURCE_DIR
. I'm not sure if it would be a better practice to useCMAKE_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.