Skip to content

Commit f54ab81

Browse files
committed
cmake
1 parent 97c3935 commit f54ab81

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,11 +2632,14 @@ if(ARROW_WITH_SIMDJSON)
26322632
# Note: simdjson is a private dependency - it's linked into libarrow
26332633
# and doesn't need to be exposed to downstream consumers.
26342634

2635-
# On Windows, force header-only mode for simdjson to avoid linking issues
2636-
# with vcpkg-provided simdjson. We add SIMDJSON_HEADER_ONLY to the target's
2637-
# interface compile definitions so all consumers get it automatically.
2638-
if(WIN32 AND TARGET simdjson::simdjson)
2639-
message(STATUS "Windows detected with simdjson target - forcing header-only mode")
2635+
# When using vcpkg-provided simdjson, force header-only mode to avoid linking
2636+
# issues. vcpkg's simdjson package provides a stub static library that expects
2637+
# consumers to use header-only mode. This applies to all platforms, not just
2638+
# Windows. We detect vcpkg by checking for VCPKG_TARGET_TRIPLET.
2639+
# We add SIMDJSON_HEADER_ONLY to the target's interface compile definitions
2640+
# so all consumers get it automatically.
2641+
if(VCPKG_TARGET_TRIPLET AND TARGET simdjson::simdjson)
2642+
message(STATUS "vcpkg detected with simdjson target - forcing header-only mode")
26402643
message(STATUS " SIMDJSON_VENDORED=${SIMDJSON_VENDORED}")
26412644
get_target_property(_simdjson_type simdjson::simdjson TYPE)
26422645
message(STATUS " simdjson target type: ${_simdjson_type}")

cpp/src/arrow/CMakeLists.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,18 +1078,10 @@ if(ARROW_JSON)
10781078
json/parser.cc
10791079
json/reader.cc
10801080
${ARROW_SIMDJSON_IMPL_SRC})
1081-
message(STATUS "ARROW_JSON: ARROW_JSON_TARGETS=${ARROW_JSON_TARGETS}")
1082-
message(STATUS "ARROW_JSON: ARROW_SIMDJSON_HEADER_ONLY=${ARROW_SIMDJSON_HEADER_ONLY}")
10831081
foreach(ARROW_JSON_TARGET ${ARROW_JSON_TARGETS})
1084-
message(STATUS "ARROW_JSON: Processing target ${ARROW_JSON_TARGET}")
10851082
target_link_libraries(${ARROW_JSON_TARGET} PRIVATE simdjson::simdjson)
1086-
# When in header-only mode, we need SIMDJSON_HEADER_ONLY defined for ALL files
1087-
# that include simdjson headers (not just the implementation file).
1088-
# The INTERFACE_COMPILE_DEFINITIONS from simdjson::simdjson should propagate this,
1089-
# but some vcpkg configurations have a static library with header-only interface
1090-
# definitions, which doesn't propagate correctly. Adding explicitly ensures it works.
1083+
# Add SIMDJSON_HEADER_ONLY when in header-only mode
10911084
if(ARROW_SIMDJSON_HEADER_ONLY)
1092-
message(STATUS "ARROW_JSON: Adding SIMDJSON_HEADER_ONLY to ${ARROW_JSON_TARGET}")
10931085
target_compile_definitions(${ARROW_JSON_TARGET} PRIVATE SIMDJSON_HEADER_ONLY)
10941086
endif()
10951087
endforeach()

0 commit comments

Comments
 (0)