From 3d0445e959856022ff38c74ca3c63f6293a2f802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 5 Nov 2026 12:43:01 +0100 Subject: [PATCH 1/2] GH-55357: [C++] Fix ORC overwritting CMAKE_MODULE_PATH when dependency not found --- cpp/cmake_modules/FindorcAlt.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/cmake_modules/FindorcAlt.cmake b/cpp/cmake_modules/FindorcAlt.cmake index ce8cd11b4c3f..38c4a7674648 100644 --- a/cpp/cmake_modules/FindorcAlt.cmake +++ b/cpp/cmake_modules/FindorcAlt.cmake @@ -26,7 +26,13 @@ endif() if(orcAlt_FIND_QUIETLY) list(APPEND find_package_args QUIET) endif() +# orcConfig.cmake overwrites CMAKE_MODULE_PATH and doesn't restore it +# when one of its dependencies isn't found because find_dependency() +# calls return() in the config file. +set(orcAlt_CMAKE_MODULE_PATH_KEEP "${CMAKE_MODULE_PATH}") find_package(orc ${find_package_args}) +set(CMAKE_MODULE_PATH "${orcAlt_CMAKE_MODULE_PATH_KEEP}") +unset(orcAlt_CMAKE_MODULE_PATH_KEEP) if(orc_FOUND) set(orcAlt_FOUND TRUE) set(orcAlt_VERSION ${orc_VERSION}) From 9f8302a9c7eccd009dc3c6c991196492fb202c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 9 Nov 2026 11:11:00 +0100 Subject: [PATCH 2/2] use block instead of set/unset interim variable --- cpp/cmake_modules/FindorcAlt.cmake | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cpp/cmake_modules/FindorcAlt.cmake b/cpp/cmake_modules/FindorcAlt.cmake index 38c4a7674648..72969dc6d319 100644 --- a/cpp/cmake_modules/FindorcAlt.cmake +++ b/cpp/cmake_modules/FindorcAlt.cmake @@ -26,13 +26,19 @@ endif() if(orcAlt_FIND_QUIETLY) list(APPEND find_package_args QUIET) endif() -# orcConfig.cmake overwrites CMAKE_MODULE_PATH and doesn't restore it -# when one of its dependencies isn't found because find_dependency() -# calls return() in the config file. -set(orcAlt_CMAKE_MODULE_PATH_KEEP "${CMAKE_MODULE_PATH}") +# orcConfig.cmake in ORC <= 2.3.1 overwrites CMAKE_MODULE_PATH and +# doesn't restore it when one of its dependencies isn't found because +# find_dependency() calls return() in the config file. We can remove +# this block() once we drop support for ORC <= 2.3.1. +block(SCOPE_FOR + VARIABLES + PROPAGATE + orc_FOUND + orc_VERSION + ORC_STATIC_LIB + ORC_INCLUDE_DIR) find_package(orc ${find_package_args}) -set(CMAKE_MODULE_PATH "${orcAlt_CMAKE_MODULE_PATH_KEEP}") -unset(orcAlt_CMAKE_MODULE_PATH_KEEP) +endblock() if(orc_FOUND) set(orcAlt_FOUND TRUE) set(orcAlt_VERSION ${orc_VERSION})