cmake_minimum_required(VERSION 3.16) project(unitree_go2_custom VERSION 1.0.0) # Set C++ standard set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Find required packages find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) # Find installed unitree_sdk2 find_package(unitree_sdk2 REQUIRED) # Find MQTT library (Eclipse Paho) pkg_check_modules(PAHO_MQTT REQUIRED libpaho-mqtt3c) pkg_check_modules(PAHO_MQTTPP REQUIRED libpaho-mqttpp3) # Find JSON library find_package(nlohmann_json REQUIRED) # Include directories include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ) # Source files set(SOURCES src/main.cpp src/mqtt.cpp src/controller.cpp src/custom_robot.cpp src/config.cpp src/logger.cpp ) # Create executable with simple name add_executable(main ${SOURCES}) # Link libraries target_link_libraries(main unitree_sdk2 ${PAHO_MQTT_LIBRARIES} ${PAHO_MQTTPP_LIBRARIES} nlohmann_json::nlohmann_json Threads::Threads ) # Compiler options target_compile_options(main PRIVATE ${PAHO_MQTT_CFLAGS_OTHER} ${PAHO_MQTTPP_CFLAGS_OTHER} ) # Set output directory set_target_properties(main PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} ) # Install target install(TARGETS main RUNTIME DESTINATION bin )