Skip to content

Commit 2b78fad

Browse files
committed
New^7 attempt to fix Windows builds
1 parent 803d899 commit 2b78fad

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,12 @@ function(build_protobuf)
18871887
"${PROTOBUF_INCLUDE_DIR}"
18881888
PARENT_SCOPE)
18891889

1890+
# Always build protobuf as static library to avoid DLL import/export issues on Windows
1891+
# Must be set BEFORE fetchcontent_declare and as CACHE FORCE to override the option()
1892+
set(protobuf_BUILD_SHARED_LIBS
1893+
OFF
1894+
CACHE BOOL "Build protobuf shared libs" FORCE)
1895+
18901896
fetchcontent_declare(protobuf
18911897
URL ${PROTOBUF_SOURCE_URL}
18921898
URL_HASH "SHA256=${ARROW_PROTOBUF_BUILD_SHA256_CHECKSUM}"
@@ -1909,11 +1915,6 @@ function(build_protobuf)
19091915
string(REPLACE "-ffat-lto-objects" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
19101916

19111917
set(protobuf_BUILD_TESTS OFF)
1912-
# Always build protobuf as static library to avoid DLL import/export issues
1913-
# Must be CACHE FORCE to override the option() in protobuf's CMakeLists.txt
1914-
set(protobuf_BUILD_SHARED_LIBS
1915-
OFF
1916-
CACHE BOOL "Build protobuf shared libs" FORCE)
19171918
if(MSVC AND NOT ARROW_USE_STATIC_CRT)
19181919
set(protobuf_MSVC_STATIC_RUNTIME OFF)
19191920
endif()
@@ -4010,11 +4011,6 @@ function(build_orc)
40104011
set(PROTOBUF_EXECUTABLE ${ARROW_PROTOBUF_PROTOC})
40114012
set(PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF})
40124013
set(PROTOC_LIBRARY ${ARROW_PROTOBUF_LIBPROTOC})
4013-
# ORC uses libprotoc - ensure it has the include directories
4014-
if(PROTOBUF_VENDORED)
4015-
target_include_directories(${ARROW_PROTOBUF_LIBPROTOC}
4016-
INTERFACE "${PROTOBUF_INCLUDE_DIR}")
4017-
endif()
40184014

40194015
set(ORC_PREFER_STATIC_SNAPPY OFF)
40204016
get_target_property(SNAPPY_INCLUDE_DIR ${Snappy_TARGET} INTERFACE_INCLUDE_DIRECTORIES)

0 commit comments

Comments
 (0)