I have installed Mujoco into /opt/mujoco
.
When I built a project that depends on Mujoco
, I made the following changes in the CMakeList.txt
:
set(MUJOCO_FOLDER /opt/mujoco/lib/cmake)
find_package(mujoco 2.3.7 REQUIRED PATHS ${MUJOCO_FOLDER} NO_DEFAULT_PATH)
if (mujoco_FOUND)
message(STATUS "Find mujoco: ${mujoco_INCLUDE_DIRS}, ${mujoco_LIBRARIES}")
endif()
Mujoco can be found and the message is also printed in the terminal, but variables ${mujoco_INCLUDE_DIRS}
and ${mujoco_LIBRARIES}
are empty.
I have removed the build
folder and rerun the cmake
command many times, but the above vars are still empty.
Besides, I checked the CMakeCache.txt
following this link, and MUJOCO_DIR:PATH
correctly points to the desired path.
What's wrong with it?
Mujoco generates a config file package, not a find-module package.
As such, it won't set any variables as part of the
find_package
call but instead provide an imported target for your executable to depend on: