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
141e8cc0
Commit
141e8cc0
authored
Jun 26, 2020
by
Nils Leif Fischer
Committed by
Wenzel Jakob
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix uninitialized-variables cmake warnings
parent
3618807d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
tools/FindPythonLibsNew.cmake
+11
-1
tools/pybind11Tools.cmake
+24
-7
No files found.
tools/FindPythonLibsNew.cmake
View file @
141e8cc0
...
...
@@ -56,6 +56,9 @@ if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION)
endif
()
# Use the Python interpreter to find the libs.
if
(
NOT PythonLibsNew_FIND_VERSION
)
set
(
PythonLibsNew_FIND_VERSION
""
)
endif
()
if
(
PythonLibsNew_FIND_REQUIRED
)
find_package
(
PythonInterp
${
PythonLibsNew_FIND_VERSION
}
REQUIRED
)
else
()
...
...
@@ -192,11 +195,18 @@ MARK_AS_ADVANCED(
# module.
SET
(
PYTHON_INCLUDE_DIRS
"
${
PYTHON_INCLUDE_DIR
}
"
)
SET
(
PYTHON_LIBRARIES
"
${
PYTHON_LIBRARY
}
"
)
if
(
NOT PYTHON_DEBUG_LIBRARY
)
SET
(
PYTHON_DEBUG_LIBRARY
""
)
endif
()
SET
(
PYTHON_DEBUG_LIBRARIES
"
${
PYTHON_DEBUG_LIBRARY
}
"
)
find_package_message
(
PYTHON
"Found PythonLibs:
${
PYTHON_LIBRARY
}
"
"
${
PYTHON_EXECUTABLE
}${
PYTHON_VERSION
}
"
)
"
${
PYTHON_EXECUTABLE
}${
PYTHON_VERSION
_STRING
}
"
)
set
(
PYTHONLIBS_FOUND TRUE
)
set
(
PythonLibsNew_FOUND TRUE
)
if
(
NOT PYTHON_MODULE_PREFIX
)
SET
(
PYTHON_MODULE_PREFIX
""
)
endif
()
tools/pybind11Tools.cmake
View file @
141e8cc0
...
...
@@ -33,7 +33,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.1)
endif
()
endif
()
# Fall back to heuristics
# Fall back to heuristics
if
(
NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD
)
if
(
MSVC
)
set
(
PYBIND11_CPP_STANDARD /std:c++14
)
...
...
@@ -142,17 +142,32 @@ function(pybind11_add_module target_name)
if
(
ARG_EXCLUDE_FROM_ALL
)
set
(
exclude_from_all EXCLUDE_FROM_ALL
)
else
()
set
(
exclude_from_all
""
)
endif
()
add_library
(
${
target_name
}
${
lib_type
}
${
exclude_from_all
}
${
ARG_UNPARSED_ARGUMENTS
}
)
if
(
ARG_SYSTEM
)
set
(
inc_isystem SYSTEM
)
else
()
set
(
inc_isystem
""
)
endif
()
set
(
PYBIND11_INCLUDE_DIR_SELECTED
""
)
if
(
PYBIND11_INCLUDE_DIR
)
# from project CMakeLists.txt
set
(
PYBIND11_INCLUDE_DIR_SELECTED
${
PYBIND11_INCLUDE_DIR
}
)
elseif
(
pybind11_INCLUDE_DIR
)
# from pybind11Config
set
(
PYBIND11_INCLUDE_DIR_SELECTED
${
pybind11_INCLUDE_DIR
}
)
else
()
message
(
FATAL
"No pybind11_INCLUDE_DIR available. Use "
"find_package(pybind11) before calling pybind11_add_module."
)
endif
()
target_include_directories
(
${
target_name
}
${
inc_isystem
}
PRIVATE
${
PYBIND11_INCLUDE_DIR
}
# from project CMakeLists.txt
PRIVATE
${
pybind11_INCLUDE_DIR
}
# from pybind11Config
PRIVATE
${
PYBIND11_INCLUDE_DIR_SELECTED
}
PRIVATE
${
PYTHON_INCLUDE_DIRS
}
)
# Python debug libraries expose slightly different objects
...
...
@@ -201,10 +216,12 @@ function(pybind11_add_module target_name)
endif
()
# Make sure C++11/14 are enabled
if
(
CMAKE_VERSION VERSION_LESS 3.3
)
target_compile_options
(
${
target_name
}
PUBLIC
${
PYBIND11_CPP_STANDARD
}
)
else
()
target_compile_options
(
${
target_name
}
PUBLIC $<$<COMPILE_LANGUAGE:CXX>:
${
PYBIND11_CPP_STANDARD
}
>
)
if
(
PYBIND11_CPP_STANDARD
)
if
(
CMAKE_VERSION VERSION_LESS 3.3
)
target_compile_options
(
${
target_name
}
PUBLIC
${
PYBIND11_CPP_STANDARD
}
)
else
()
target_compile_options
(
${
target_name
}
PUBLIC $<$<COMPILE_LANGUAGE:CXX>:
${
PYBIND11_CPP_STANDARD
}
>
)
endif
()
endif
()
if
(
ARG_NO_EXTRAS
)
...
...
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