Skip to content

Commit 3b88026

Browse files
Don't require a leading underscore in PYBIND11_NONLIMITEDAPI_SUFFIX.
1 parent 1318656 commit 3b88026

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/non_limited_api/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif()
2121
option(PYBIND11_NONLIMITEDAPI_BUILD_STUBS "Build the stubs library." ON)
2222

2323
set(PYBIND11_NONLIMITEDAPI_PYTHON_MIN_VERSION_HEX "" CACHE STRING "A hex Python version to bake into the library, e.g. `0x030800f0` for 3.8 (the `f0` suffix is always there and means a release version).")
24-
set(PYBIND11_NONLIMITEDAPI_SUFFIX "" CACHE STRING "A custom suffix to append to the built library name. Should normally be `[_AppName][_X.Y]`, where X,Y is the Python version.")
24+
set(PYBIND11_NONLIMITEDAPI_SUFFIX "" CACHE STRING "A custom suffix to append to the built library name.")
2525
set(PYBIND11_NONLIMITEDAPI_LIBRARY_OUTPUT_DIR "" CACHE PATH "Replaces the library installation path for the shim.")
2626

2727
include(GNUInstallDirs)
@@ -68,7 +68,13 @@ endif()
6868
if (PYBIND11_NONLIMITEDAPI_PYTHON_MIN_VERSION_HEX STREQUAL "")
6969
message("Not building shim because no Python version is specified.")
7070
else()
71-
set(PYBIND11_NONLIMITEDAPI_LIBNAME "pybind11nonlimitedapi${PYBIND11_NONLIMITEDAPI_SUFFIX}_${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")
71+
if (NOT "${PYBIND11_NONLIMITEDAPI_SUFFIX}" STREQUAL "")
72+
set(PYBIND11_NONLIMITEDAPI_UNDERSCORE "_")
73+
else()
74+
set(PYBIND11_NONLIMITEDAPI_UNDERSCORE "")
75+
endif()
76+
77+
set(PYBIND11_NONLIMITEDAPI_LIBNAME "pybind11nonlimitedapi${PYBIND11_NONLIMITEDAPI_UNDERSCORE}${PYBIND11_NONLIMITEDAPI_SUFFIX}_${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")
7278
project(${PYBIND11_NONLIMITEDAPI_LIBNAME})
7379
add_library(${PROJECT_NAME} SHARED non_limited_api.cpp)
7480

0 commit comments

Comments
 (0)