Skip to content

Commit 6ea63b5

Browse files
committed
Try to avoid ORC hardcoding CXX 17 and failing with our built protobuf when linking v2
1 parent acf0f54 commit 6ea63b5

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,12 +3638,6 @@ function(build_orc)
36383638

36393639
set(CMAKE_UNITY_BUILD FALSE)
36403640

3641-
# ORC's CMakeLists.txt unconditionally adds /std:c++17 on MSVC via
3642-
# add_compile_options, which overrides CMAKE_CXX_STANDARD and causes
3643-
# ABI mismatches with protobuf. Prevent this by pre-setting the check
3644-
# result so the flag is not added.
3645-
set(CPP17_FLAG_SUPPORTED OFF)
3646-
36473641
set(ORC_PREFER_STATIC_LZ4 OFF)
36483642
set(LZ4_HOME "${ORC_LZ4_ROOT}")
36493643
set(LZ4_INCLUDE_DIR "${ORC_LZ4_INCLUDE_DIR}")
@@ -3693,6 +3687,15 @@ function(build_orc)
36933687

36943688
fetchcontent_makeavailable(orc)
36953689

3690+
# ORC 2.2.1 unconditionally adds /std:c++17 on MSVC via
3691+
# add_compile_options, which overrides CMAKE_CXX_STANDARD and causes
3692+
# ABI mismatches with protobuf (GlobalEmptyStringConstexpr vs
3693+
# GlobalEmptyStringDynamicInit). Override the standard on the orc target.
3694+
# Fixed in ORC 2.3.0: https://github.com/apache/orc/commit/7674f43
3695+
if(MSVC)
3696+
target_compile_options(orc PRIVATE "/std:c++${CMAKE_CXX_STANDARD}")
3697+
endif()
3698+
36963699
add_library(orc::orc INTERFACE IMPORTED)
36973700
target_link_libraries(orc::orc INTERFACE orc)
36983701
target_link_libraries(orc::orc INTERFACE ${ARROW_PROTOBUF_LIBPROTOBUF})

0 commit comments

Comments
 (0)