diff --git a/recipes/webots-controller/all/src/controller/c/CMakeLists.txt b/recipes/webots-controller/all/src/controller/c/CMakeLists.txt index 813f20a..9511747 100644 --- a/recipes/webots-controller/all/src/controller/c/CMakeLists.txt +++ b/recipes/webots-controller/all/src/controller/c/CMakeLists.txt @@ -65,8 +65,13 @@ set(WEBOTS_CONTROLLER_C_PLUGIN_SOURCES dynamic_library.c html_robot_window.c set(WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_CORE_SOURCES}) list(APPEND WEBOTS_CONTROLLER_C_SOURCES ${WEBOTS_CONTROLLER_C_PLUGIN_SOURCES}) - -list(TRANSFORM WEBOTS_CONTROLLER_C_SOURCES PREPEND "${WEBOTS_CONTROLLER_C_SOURCE_DIR}/") +set(WEBOTS_CONTROLLER_C_SOURCE_PATHS) +foreach(_src IN LISTS WEBOTS_CONTROLLER_C_SOURCES) + set(_candidate "${WEBOTS_CONTROLLER_C_SOURCE_DIR}/${_src}") + if(EXISTS "${_candidate}") + list(APPEND WEBOTS_CONTROLLER_C_SOURCE_PATHS "${_candidate}") + endif() +endforeach() if(MSVC) find_package(Git REQUIRED) @@ -88,11 +93,17 @@ if(MSVC) message(FATAL_ERROR "Failed to apply MSVC controller C source patch") endif() - list(TRANSFORM WEBOTS_CONTROLLER_C_SOURCES - REPLACE "^${WEBOTS_CONTROLLER_C_SOURCE_DIR}" "${WEBOTS_CONTROLLER_MSVC_SOURCE_DIR}") + set(_msvc_source_paths) + foreach(_src IN LISTS WEBOTS_CONTROLLER_C_SOURCES) + set(_candidate "${WEBOTS_CONTROLLER_MSVC_SOURCE_DIR}/${_src}") + if(EXISTS "${_candidate}") + list(APPEND _msvc_source_paths "${_candidate}") + endif() + endforeach() + set(WEBOTS_CONTROLLER_C_SOURCE_PATHS ${_msvc_source_paths}) endif() -add_library(webots_controller ${WEBOTS_CONTROLLER_C_SOURCES}) +add_library(webots_controller ${WEBOTS_CONTROLLER_C_SOURCE_PATHS}) add_library(webots-controller::webots_controller ALIAS webots_controller) add_library(webots-controller::Controller ALIAS webots_controller) diff --git a/recipes/webots-controller/all/src/controller/cpp/CMakeLists.txt b/recipes/webots-controller/all/src/controller/cpp/CMakeLists.txt index 75b2ee4..9b8d5bb 100644 --- a/recipes/webots-controller/all/src/controller/cpp/CMakeLists.txt +++ b/recipes/webots-controller/all/src/controller/cpp/CMakeLists.txt @@ -37,12 +37,18 @@ set(WEBOTS_CONTROLLER_CPP_SOURCES TouchSensor.cpp VacuumGripper.cpp) -list(TRANSFORM WEBOTS_CONTROLLER_CPP_SOURCES PREPEND "${WEBOTS_CONTROLLER_CPP_SOURCE_DIR}/") +set(WEBOTS_CONTROLLER_CPP_SOURCE_PATHS) +foreach(_src IN LISTS WEBOTS_CONTROLLER_CPP_SOURCES) + set(_candidate "${WEBOTS_CONTROLLER_CPP_SOURCE_DIR}/${_src}") + if(EXISTS "${_candidate}") + list(APPEND WEBOTS_CONTROLLER_CPP_SOURCE_PATHS "${_candidate}") + endif() +endforeach() file(GLOB_RECURSE WEBOTS_CONTROLLER_CPP_PUBLIC_HEADERS CONFIGURE_DEPENDS "${WEBOTS_REPO_SOURCE_DIR}/include/controller/cpp/webots/*.hpp") -add_library(webots_cpp_controller ${WEBOTS_CONTROLLER_CPP_SOURCES}) +add_library(webots_cpp_controller ${WEBOTS_CONTROLLER_CPP_SOURCE_PATHS}) add_library(webots-controller::webots_cpp_controller ALIAS webots_cpp_controller) add_library(webots-controller::CppController ALIAS webots_cpp_controller) @@ -77,4 +83,4 @@ install( LIBRARY DESTINATION "lib" ARCHIVE DESTINATION "lib" FILE_SET webots_cpp_headers - DESTINATION "include/controller/cpp") \ No newline at end of file + DESTINATION "include/controller/cpp")