Skip to content

Commit 3b67996

Browse files
rhaschkeDavidPL1
authored andcommittedDec 2, 2024
Allow MUJOCO_DIR to be specified as cmake variable
1 parent f640ba0 commit 3b67996

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎mujoco_ros/cmake/Findmujoco.cmake

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ endif()
99

1010
if(NOT mujoco_FOUND)
1111
message(STATUS "Looking for MuJoCo tar install ...")
12+
# Initialize MUJOCO_DIR from environment variable if not yet set as cmake variable
13+
if(NOT DEFINED MUJOCO_DIR)
14+
set(MUJOCO_DIR $ENV{MUJOCO_DIR} CACHE PATH "Path to MuJoCo installation directory")
15+
endif()
1216
# Find headers
13-
find_file(mujoco_INCLUDE_DIRS include/mujoco/mujoco.h PATHS ENV MUJOCO_DIR)
17+
find_file(mujoco_INCLUDE_DIRS include/mujoco/mujoco.h PATHS ${MUJOCO_DIR})
1418
if(mujoco_INCLUDE_DIRS)
1519
get_filename_component(mujoco_INCLUDE_DIRS ${mujoco_INCLUDE_DIRS} PATH)
1620
get_filename_component(mujoco_INCLUDE_DIRS ${mujoco_INCLUDE_DIRS} PATH)
1721
endif()
1822

1923
# Find library
20-
find_library(mujoco_LIBRARIES lib/libmujoco.so PATHS ENV MUJOCO_DIR)
24+
find_library(mujoco_LIBRARIES lib/libmujoco.so PATHS ${MUJOCO_DIR})
2125

2226
# Find dependencies
2327
cmake_policy(SET CMP0072 NEW)

0 commit comments

Comments
 (0)