I'm using a CMakeLists.txt to build for my C++ file I want to include the external library MuJoCo but the MuJoCo repo has no mujoco-config.cmake, or mujocoConfig.cmake file.
Is there another way to include it?
There is a cmake
folder in the repo, pictured below. It has a mujocoConfig.cmake.in
file in it. I don't know how to use it. I don't know if it or anything else in this cmake
folder is what I need.
This is the mujocoConfig.cmake.in
file.
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(OpenGL)
if(NOT TARGET mujoco AND NOT @PROJECT_NAME@_BINARY_DIR)
include("${CMAKE_CURRENT_LIST_DIR}/mujocoTargets.cmake")
endif()
check_required_components(mujoco)
This is my CMakeLists.txt, which is giving me a mujocoConfig not found error
.
cmake_minimum_required(VERSION 3.5.1)
project(mujoco_gym)
set(CMAKE_CXX_STANDARD 14)
# It prevents the decay to C++98 when the compiler does not support C++14
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# It disables the use of compiler-specific extensions
# e.g. -std=c++14 rather than -std=gnu++14
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(Mujoco_DIR mujoco)
find_package(Mujoco PATHS ${Mujoco_DIR} NO_DEFAULT REQUIRED)
if (Mujoco_FOUND)
message(STATUS "Mujoco library found!")
message(STATUS " include path: ${MUJOCO_INCLUDE_DIRS}" \n)
else ()
message(FATAL_ERROR "Could not locate Mujoco" \n)
endif()
target_include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
file(GLOB SOURCE_FILES mujoco_gym.cpp)
#CMAKE_PROJECT_NAME is from 'project(mujoco_gym)' on the second line of this script
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries (
${CMAKE_PROJECT_NAME}
${MUJOCO_LIBRARIES}
)
Progress Update:
Progress Update:
Progress Update:
I found the mujocoConfig.cmake in the build folder after I built the mujoco library from source. (I couldn't find mujocoConfig.cmake at first because I was looking for it on GitHub.
Now I am finding the mujocoConfig.cmake
with my CMakelists.txt but this mujocoConfig.cmake
is looking for mujocoTargets.cmake
.
It's in /mujoco/build/CMakeFiles/Export/lib/cmake/mujoco
but I don't know how to point to it in CMakeLists.txt.
It's looking in the build folder
CMake Error at /home/iii/tor/m_gym/mujoco/build/mujocoConfig.cmake:45 (include):
include could not find requested file:
/home/iii/tor/m_gym/mujoco/build/mujocoTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:24 (find_package)