Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
b8dc60ec
Unverified
Commit
b8dc60ec
authored
Nov 02, 2020
by
Henry Schreiner
Committed by
GitHub
Nov 02, 2020
Browse files
fix: Python include directory was missing from DIRS (#2636)
parent
7d6713a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
CMakeLists.txt
CMakeLists.txt
+13
-9
tools/pybind11Common.cmake
tools/pybind11Common.cmake
+6
-0
tools/pybind11NewTools.cmake
tools/pybind11NewTools.cmake
+3
-0
tools/pybind11Tools.cmake
tools/pybind11Tools.cmake
+4
-0
No files found.
CMakeLists.txt
View file @
b8dc60ec
...
@@ -142,10 +142,17 @@ endif()
...
@@ -142,10 +142,17 @@ endif()
string
(
REPLACE
"include/"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/"
PYBIND11_HEADERS
string
(
REPLACE
"include/"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/"
PYBIND11_HEADERS
"
${
PYBIND11_HEADERS
}
"
)
"
${
PYBIND11_HEADERS
}
"
)
# Cache variable
s
so
pybind11_add_module
can be used in parent projects
# Cache variable so
this
can be used in parent projects
set
(
PYBIND
11_INCLUDE_DIR
set
(
pybind
11_INCLUDE_DIR
"
${
CMAKE_CURRENT_LIST_DIR
}
/include"
"
${
CMAKE_CURRENT_LIST_DIR
}
/include"
CACHE INTERNAL
""
)
CACHE INTERNAL
"Directory where pybind11 headers are located"
)
# Backward compatible variable for add_subdirectory mode
if
(
NOT PYBIND11_MASTER_PROJECT
)
set
(
PYBIND11_INCLUDE_DIR
"
${
pybind11_INCLUDE_DIR
}
"
CACHE INTERNAL
""
)
endif
()
# Note: when creating targets, you cannot use if statements at configure time -
# Note: when creating targets, you cannot use if statements at configure time -
# you need generator expressions, because those will be placed in the target file.
# you need generator expressions, because those will be placed in the target file.
...
@@ -170,14 +177,14 @@ endif()
...
@@ -170,14 +177,14 @@ endif()
# Fill in headers target
# Fill in headers target
target_include_directories
(
target_include_directories
(
pybind11_headers
${
pybind11_system
}
INTERFACE $<BUILD_INTERFACE:
${
PYBIND
11_INCLUDE_DIR
}
>
pybind11_headers
${
pybind11_system
}
INTERFACE $<BUILD_INTERFACE:
${
pybind
11_INCLUDE_DIR
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
target_compile_features
(
pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
target_compile_features
(
pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
cxx_right_angle_brackets
)
cxx_right_angle_brackets
)
if
(
PYBIND11_INSTALL
)
if
(
PYBIND11_INSTALL
)
install
(
DIRECTORY
${
PYBIND
11_INCLUDE_DIR
}
/pybind11 DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
install
(
DIRECTORY
${
pybind
11_INCLUDE_DIR
}
/pybind11 DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
set
(
PYBIND11_CMAKECONFIG_INSTALL_DIR
set
(
PYBIND11_CMAKECONFIG_INSTALL_DIR
"
${
CMAKE_INSTALL_DATAROOTDIR
}
/cmake/
${
PROJECT_NAME
}
"
"
${
CMAKE_INSTALL_DATAROOTDIR
}
/cmake/
${
PROJECT_NAME
}
"
CACHE STRING
"install path for pybind11Config.cmake"
)
CACHE STRING
"install path for pybind11Config.cmake"
)
...
@@ -259,8 +266,5 @@ endif()
...
@@ -259,8 +266,5 @@ endif()
if
(
NOT PYBIND11_MASTER_PROJECT
)
if
(
NOT PYBIND11_MASTER_PROJECT
)
set
(
pybind11_FOUND
set
(
pybind11_FOUND
TRUE
TRUE
CACHE INTERNAL
"true if pybind11 and all required components found on the system"
)
CACHE INTERNAL
"True if pybind11 and all required components found on the system"
)
set
(
pybind11_INCLUDE_DIR
"
${
PYBIND11_INCLUDE_DIR
}
"
CACHE INTERNAL
"Directory where pybind11 headers are located"
)
endif
()
endif
()
tools/pybind11Common.cmake
View file @
b8dc60ec
...
@@ -36,6 +36,12 @@ if(NOT is_config)
...
@@ -36,6 +36,12 @@ if(NOT is_config)
set
(
optional_global GLOBAL
)
set
(
optional_global GLOBAL
)
endif
()
endif
()
# If not run in Python mode, we still would like this to at least
# include pybind11's include directory:
set
(
pybind11_INCLUDE_DIRS
"
${
pybind11_INCLUDE_DIR
}
"
CACHE INTERNAL
"Include directory for pybind11 (Python not requested)"
)
# --------------------- Shared targets ----------------------------
# --------------------- Shared targets ----------------------------
# Build an interface library target:
# Build an interface library target:
...
...
tools/pybind11NewTools.cmake
View file @
b8dc60ec
...
@@ -130,6 +130,9 @@ if(DEFINED ${_Python}_INCLUDE_DIRS)
...
@@ -130,6 +130,9 @@ if(DEFINED ${_Python}_INCLUDE_DIRS)
TARGET pybind11::pybind11
TARGET pybind11::pybind11
APPEND
APPEND
PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:
${${
_Python
}
_INCLUDE_DIRS
}
>
)
PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:
${${
_Python
}
_INCLUDE_DIRS
}
>
)
set
(
pybind11_INCLUDE_DIRS
"
${
pybind11_INCLUDE_DIR
}
"
"
${${
_Python
}
_INCLUDE_DIRS
}
"
CACHE INTERNAL
"Directories where pybind11 and possibly Python headers are located"
)
endif
()
endif
()
if
(
DEFINED
${
_Python
}
_VERSION AND
${
_Python
}
_VERSION VERSION_LESS 3
)
if
(
DEFINED
${
_Python
}
_VERSION AND
${
_Python
}
_VERSION VERSION_LESS 3
)
...
...
tools/pybind11Tools.cmake
View file @
b8dc60ec
...
@@ -87,6 +87,10 @@ set_property(
...
@@ -87,6 +87,10 @@ set_property(
APPEND
APPEND
PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:
${
PYTHON_INCLUDE_DIRS
}
>
)
PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:
${
PYTHON_INCLUDE_DIRS
}
>
)
set
(
pybind11_INCLUDE_DIRS
"
${
pybind11_INCLUDE_DIR
}
"
"
${
PYTHON_INCLUDE_DIRS
}
"
CACHE INTERNAL
"Directories where pybind11 and possibly Python headers are located"
)
# Python debug libraries expose slightly different objects before 3.8
# Python debug libraries expose slightly different objects before 3.8
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
# https://stackoverflow.com/questions/39161202/how-to-work-around-missing-pymodule-create2-in-amd64-win-python35-d-lib
# https://stackoverflow.com/questions/39161202/how-to-work-around-missing-pymodule-create2-in-amd64-win-python35-d-lib
...
...
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