@@ -69,7 +69,14 @@ if (EXISTS ${INFERA_RUST_LIB})
6969 # Create an imported target for the Rust library
7070 add_library (infera_rust STATIC IMPORTED GLOBAL )
7171 if (UNIX )
72- set (_INFERA_RUST_LINK_LIBS "pthread;dl;m" )
72+ if (APPLE )
73+ # reqwest 0.13 uses rustls-platform-verifier on Apple platforms, which
74+ # calls into the macOS Security and CoreFoundation frameworks. Link them
75+ # explicitly so the static Rust archive resolves at extension link time.
76+ set (_INFERA_RUST_LINK_LIBS "pthread;dl;m;-framework Security;-framework CoreFoundation;-framework SystemConfiguration" )
77+ else ()
78+ set (_INFERA_RUST_LINK_LIBS "pthread;dl;m" )
79+ endif ()
7380 else ()
7481 set (_INFERA_RUST_LINK_LIBS "" )
7582 endif ()
@@ -80,7 +87,11 @@ if (EXISTS ${INFERA_RUST_LIB})
8087
8188 # Add the Rust library to global link libraries so it gets linked to everything
8289 if (UNIX )
83- link_libraries (${INFERA_RUST_LIB} pthread dl m )
90+ if (APPLE )
91+ link_libraries (${INFERA_RUST_LIB} pthread dl m "-framework Security" "-framework CoreFoundation" "-framework SystemConfiguration" )
92+ else ()
93+ link_libraries (${INFERA_RUST_LIB} pthread dl m )
94+ endif ()
8495 else ()
8596 link_libraries (${INFERA_RUST_LIB} )
8697 if (WIN32 )
@@ -107,6 +118,11 @@ if (EXISTS ${INFERA_RUST_LIB})
107118 add_link_options ($<$<STREQUAL :$<TARGET_PROPERTY :TYPE >,EXECUTABLE >:-lpthread >)
108119 add_link_options ($<$<STREQUAL :$<TARGET_PROPERTY :TYPE >,EXECUTABLE >:-ldl >)
109120 add_link_options ($<$<STREQUAL :$<TARGET_PROPERTY :TYPE >,EXECUTABLE >:-lm >)
121+ # Apple framework flags are NOT added via add_link_options: CMake splits
122+ # "-framework Security" at the space inside generator expressions, producing
123+ # the literal token '$<0:-framework' instead of an empty string. The frameworks
124+ # are already propagated to all targets by link_libraries() and
125+ # INTERFACE_LINK_LIBRARIES above, so no add_link_options entry is needed.
110126 else ()
111127 add_link_options ($<$<STREQUAL :$<TARGET_PROPERTY :TYPE >,EXECUTABLE >:${INFERA_RUST_LIB} >)
112128 endif ()
0 commit comments