From aab127ddca11f39c319fae56e004bce22fbf5645 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Tue, 16 Apr 2024 16:49:38 +0200 Subject: [PATCH] iox-#2011 Apply cpptoml patch only if not yet applied --- iceoryx_posh/cmake/cpptoml/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/iceoryx_posh/cmake/cpptoml/CMakeLists.txt b/iceoryx_posh/cmake/cpptoml/CMakeLists.txt index 08aff834c2..e21489a75f 100644 --- a/iceoryx_posh/cmake/cpptoml/CMakeLists.txt +++ b/iceoryx_posh/cmake/cpptoml/CMakeLists.txt @@ -73,12 +73,21 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE) endif() execute_process( - COMMAND git apply -p1 --ignore-space-change --whitespace=nowarn + COMMAND git apply -R -p1 --ignore-space-change --whitespace=nowarn --quiet --check INPUT_FILE "${CMAKE_CURRENT_LIST_DIR}/0001-cpptoml-cmake-version.patch" WORKING_DIRECTORY "${SOURCE_DIR}" RESULT_VARIABLE result) if(result) - message(WARNING "CMake step [patch] for '${PROJECT_NAME}' failed! Error code: ${result}! Build of '${PROJECT_NAME}' might fail") + message(STATUS "Applying patch for minimal cmake version to cpptoml") + + execute_process( + COMMAND git apply -p1 --ignore-space-change --whitespace=nowarn + INPUT_FILE "${CMAKE_CURRENT_LIST_DIR}/0001-cpptoml-cmake-version.patch" + WORKING_DIRECTORY "${SOURCE_DIR}" + RESULT_VARIABLE result) + if(result) + message(FATAL_ERROR "CMake step [patch] for '${PROJECT_NAME}' failed! Error code: ${result}!") + endif() endif() execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "-DENABLE_LIBCXX=off" "-DCPPTOML_BUILD_EXAMPLES=off" "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}" "${SOURCE_DIR}" ${CMAKE_ADDITIONAL_OPTIONS}