Skip to content

Commit d36a49a

Browse files
authored
Use Python3::Module
Replace `$Python3_LIBRARIES` with `Python3::Module` in`swig_link_libraries`. This is a better resolution to #398 Tested on Linux (in python and manylinux docker images), Windows 11 w/ VS 2022, and macOS. The [officially suggested fix](https://gitlab.kitware.com/cmake/cmake/-/issues/26503#note_1600940) works, and feels much better than my initial workaround. Signed-off-by: Andy Neff <[email protected]>
1 parent b95b824 commit d36a49a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,7 @@ if (WITH_PYTHON)
6767
find_package(SWIG 4.0)
6868
# Use Python3_ROOT_DIR to help find python3, if the correct location is not
6969
# being found by default.
70-
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
71-
# Workaround for issue https://github.com/google/s2geometry/issues/398
72-
# Macos requires libpython3.13.dylib and does not get it with .Module
73-
find_package(Python3 COMPONENTS Interpreter Development)
74-
else()
75-
find_package(Python3 COMPONENTS Interpreter Development.Module)
76-
endif()
70+
find_package(Python3 COMPONENTS Interpreter Development.Module)
7771
endif()
7872

7973
if (MSVC)

src/python/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set_property(SOURCE s2.i PROPERTY CPLUSPLUS ON)
3535

3636
swig_add_library(s2geometry LANGUAGE python SOURCES s2.i)
3737

38-
swig_link_libraries(s2geometry ${Python3_LIBRARIES} s2)
38+
swig_link_libraries(s2geometry Python3::Module s2)
3939
enable_testing()
4040
add_test(NAME s2geometry_test COMMAND
4141
${Python3_EXECUTABLE}

0 commit comments

Comments
 (0)