Skip to content

Commit 113534d

Browse files
authored
[MLIR] Fix nanobind linker args on macOS (#125733)
Set the "-U,_PyClassMethod_New" linker flag on the Python library itself isntead of on the CMAKE_MODULE_LINKER_FLAGS property.
1 parent 4e14b8a commit 113534d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ function(add_mlir_python_extension libname extname)
709709
# NanobindAdaptors.h uses PyClassMethod_New to build `pure_subclass`es but nanobind
710710
# doesn't declare this API as undefined in its linker flags. So we need to declare it as such
711711
# for downstream users that do not do something like `-undefined dynamic_lookup`.
712-
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-U -Wl,_PyClassMethod_New")
712+
target_link_options(${libname} PUBLIC "LINKER:-U,_PyClassMethod_New")
713713
endif()
714714
endif()
715715

0 commit comments

Comments
 (0)