chore: update LIBCONTROLLER_VERSION handling from conan to cmake

This commit is contained in:
insleker 2026-05-22 10:47:30 +08:00
parent f9c06a057c
commit 37fcab3cfb
3 changed files with 7 additions and 3 deletions

View File

@ -49,6 +49,10 @@ class WebotsControllerConan(ConanFile):
tc = CMakeToolchain(self)
# tc.variables["BUILD_SHARED_LIBS"] = bool(self.options.shared)
tc.variables["WEBOTS_CONTROLLER_NO_PLUGINS"] = bool(self.options.no_plugins)
libcontroller_version = str(self.version)
if libcontroller_version.startswith("r"):
libcontroller_version = f"R{libcontroller_version[1:]}"
tc.variables["LIBCONTROLLER_VERSION"] = libcontroller_version
tc.generate()
def build(self):

View File

@ -154,8 +154,8 @@ target_include_directories(
PRIVATE ${WEBOTS_STB_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${WEBOTS_CONTROLLER_MSVC_SOURCE_DIR})
target_compile_definitions(webots_controller
PRIVATE LIBCONTROLLER_VERSION="R2025a")
target_compile_definitions(
webots_controller PRIVATE LIBCONTROLLER_VERSION="${LIBCONTROLLER_VERSION}")
if(WEBOTS_CONTROLLER_NO_PLUGINS)
target_compile_definitions(webots_controller
PUBLIC WEBOTS_CONTROLLER_NO_PLUGINS=1)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)
project(test_package C CXX)
find_package(webots-controller REQUIRED CONFIG)