Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
d46f3322
Unverified
Commit
d46f3322
authored
Oct 09, 2020
by
Henry Schreiner
Committed by
GitHub
Oct 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: allow cmake varibles from Python calls to be cached (#2570)
parent
fecef388
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
tools/pybind11NewTools.cmake
+17
-9
No files found.
tools/pybind11NewTools.cmake
View file @
d46f3322
...
...
@@ -80,30 +80,38 @@ if(NOT DEFINED ${_Python}_EXECUTABLE)
endif
()
# Debug check - see https://stackoverflow.com/questions/646518/python-how-to-detect-debug-Interpreter
execute_process
(
COMMAND
"
${${
_Python
}
_EXECUTABLE
}
"
"-c"
"import sys; sys.exit(hasattr(sys, 'gettotalrefcount'))"
RESULT_VARIABLE PYTHON_IS_DEBUG
)
if
(
NOT DEFINED PYTHON_IS_DEBUG
)
# Debug check - see https://stackoverflow.com/questions/646518/python-how-to-detect-debug-Interpreter
execute_process
(
COMMAND
"
${${
_Python
}
_EXECUTABLE
}
"
"-c"
"import sys; sys.exit(hasattr(sys, 'gettotalrefcount'))"
RESULT_VARIABLE _PYTHON_IS_DEBUG
)
set
(
PYTHON_IS_DEBUG
"
${
_PYTHON_IS_DEBUG
}
"
CACHE INTERNAL
"Python debug status"
)
endif
()
# Get the suffix - SO is deprecated, should use EXT_SUFFIX, but this is
# required for PyPy3 (as of 7.3.1)
execute_process
(
if
(
NOT DEFINED PYTHON_MODULE_EXTENSION
)
execute_process
(
COMMAND
"
${${
_Python
}
_EXECUTABLE
}
"
"-c"
"from distutils import sysconfig; print(sysconfig.get_config_var('SO'))"
OUTPUT_VARIABLE _PYTHON_MODULE_EXTENSION
ERROR_VARIABLE _PYTHON_MODULE_EXTENSION_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
_PYTHON_MODULE_EXTENSION STREQUAL
""
)
if
(
_PYTHON_MODULE_EXTENSION STREQUAL
""
)
message
(
FATAL_ERROR
"pybind11 could not query the module file extension, likely the 'distutils'"
"package is not installed. Full error message:
\n
${
_PYTHON_MODULE_EXTENSION_ERR
}
"
)
endif
()
endif
()
# This needs to be available for the pybind11_extension function
set
(
PYTHON_MODULE_EXTENSION
# This needs to be available for the pybind11_extension function
set
(
PYTHON_MODULE_EXTENSION
"
${
_PYTHON_MODULE_EXTENSION
}
"
CACHE INTERNAL
""
)
endif
()
# Python debug libraries expose slightly different objects before 3.8
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment