Skip to content

Commit a1c5e32

Browse files
authored
fix(cmake): Handle empty SKBUILD_SABI_VERSION (#980)
This is an empty string when it's not building for the Stable ABI. I chose to check if it's defined and check if it's empty in two steps, though if you'd prefer, the empty check also is False if it's not defined. The form I used is slightly clearer, and might work a little better if someone passes `--warn-uninitialized` (maybe the second one passes that too, not sure).
1 parent eb4ff18 commit a1c5e32

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmake/nanobind-config.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ endif()
2828

2929

3030
# Error if scikit-build-core is trying to build Stable ABI < 3.12 wheels
31-
if(DEFINED SKBUILD_SABI_VERSION AND SKBUILD_SABI_VERSION VERSION_LESS "3.12")
32-
message(FATAL_ERROR "You must set tool.scikit-build.wheel.py-api to 'cp312' or later when using scikit-build-core with nanobind.")
31+
if(DEFINED SKBUILD_SABI_VERSION AND SKBUILD_ABI_VERSION AND SKBUILD_SABI_VERSION VERSION_LESS "3.12")
32+
message(FATAL_ERROR "You must set tool.scikit-build.wheel.py-api to 'cp312' or later when "
33+
"using scikit-build-core with nanobind, '${SKBUILD_SABI_VERSION}' is too old.")
3334
endif()
3435

3536
# PyPy sets an invalid SOABI (platform missing), causing older FindPythons to

0 commit comments

Comments
 (0)