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
1f53c373
Commit
1f53c373
authored
Jul 23, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Jul 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: C++17 mode on Clang may error
parent
e428a7f6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
3 deletions
+56
-3
tests/CMakeLists.txt
+3
-3
tests/test_cmake_build/installed_embed/CMakeLists.txt
+9
-0
tests/test_cmake_build/installed_target/CMakeLists.txt
+8
-0
tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
+10
-0
tests/test_cmake_build/subdirectory_target/CMakeLists.txt
+8
-0
tests/test_embed/CMakeLists.txt
+10
-0
tools/pybind11Tools.cmake
+8
-0
No files found.
tests/CMakeLists.txt
View file @
1f53c373
...
...
@@ -152,10 +152,10 @@ function(pybind11_enable_warnings target_name)
endif
()
endif
()
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD
STREQUAL
"14"
)
if
(
CMAKE_CXX_
STANDARD AND CMAKE_CXX_
COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD
LESS 17
)
target_compile_options
(
${
target_name
}
PUBLIC -Wno-deprecated-register
)
else
if
(
NOT CMAKE_CXX_STANDARD VERSION_LESS 17
)
else
(
)
target_compile_options
(
${
target_name
}
PUBLIC -Wno-register
)
endif
()
endif
()
...
...
tests/test_cmake_build/installed_embed/CMakeLists.txt
View file @
1f53c373
...
...
@@ -8,8 +8,17 @@ message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
add_executable
(
test_cmake_build ../embed.cpp
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::embed
)
# Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed).
# This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
set_target_properties
(
test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON
)
add_custom_target
(
check $<TARGET_FILE:test_cmake_build>
${
PROJECT_SOURCE_DIR
}
/../test.py
)
if
(
CMAKE_CXX_STANDARD AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
test_cmake_build PUBLIC -Wno-deprecated-register
)
else
()
target_compile_options
(
test_cmake_build PUBLIC -Wno-register
)
endif
()
endif
()
tests/test_cmake_build/installed_target/CMakeLists.txt
View file @
1f53c373
...
...
@@ -20,3 +20,11 @@ set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
add_custom_target
(
check
${
CMAKE_COMMAND
}
-E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
${
PYTHON_EXECUTABLE
}
${
PROJECT_SOURCE_DIR
}
/../test.py
${
PROJECT_NAME
}
)
if
(
CMAKE_CXX_STANDARD AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
test_cmake_build PUBLIC -Wno-deprecated-register
)
else
()
target_compile_options
(
test_cmake_build PUBLIC -Wno-register
)
endif
()
endif
()
tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
View file @
1f53c373
...
...
@@ -23,3 +23,13 @@ install(TARGETS test_embed_lib
RUNTIME DESTINATION lib
)
install
(
EXPORT test_export
DESTINATION lib/cmake/test_export/test_export-Targets.cmake
)
if
(
CMAKE_CXX_STANDARD AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
test_embed_lib PUBLIC -Wno-deprecated-register
)
target_compile_options
(
test_cmake_build PUBLIC -Wno-deprecated-register
)
else
()
target_compile_options
(
test_embed_lib PUBLIC -Wno-register
)
target_compile_options
(
test_cmake_build PUBLIC -Wno-register
)
endif
()
endif
()
tests/test_cmake_build/subdirectory_target/CMakeLists.txt
View file @
1f53c373
...
...
@@ -13,3 +13,11 @@ set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX
add_custom_target
(
check
${
CMAKE_COMMAND
}
-E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
${
PYTHON_EXECUTABLE
}
${
PROJECT_SOURCE_DIR
}
/../test.py
${
PROJECT_NAME
}
)
if
(
CMAKE_CXX_STANDARD AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
test_cmake_build PUBLIC -Wno-deprecated-register
)
else
()
target_compile_options
(
test_cmake_build PUBLIC -Wno-register
)
endif
()
endif
()
tests/test_embed/CMakeLists.txt
View file @
1f53c373
...
...
@@ -43,3 +43,13 @@ endforeach()
add_dependencies
(
cpptest external_module
)
add_dependencies
(
check cpptest
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
)
if
(
CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
test_embed PUBLIC -Wno-deprecated-register
)
target_compile_options
(
external_module PUBLIC -Wno-deprecated-register
)
else
()
target_compile_options
(
test_embed PUBLIC -Wno-register
)
target_compile_options
(
external_module PUBLIC -Wno-register
)
endif
()
endif
()
tools/pybind11Tools.cmake
View file @
1f53c373
...
...
@@ -224,6 +224,14 @@ function(pybind11_add_module target_name)
endif
()
endif
()
# Python 2 doesn't really support C++17, Clang warns/errors over it
if
(
CMAKE_CXX_STANDARD
AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
AND PYTHON_VERSION VERSION_LESS 3.0
AND NOT CMAKE_CXX_STANDARD LESS 17
)
target_compile_options
(
${
target_name
}
PUBLIC -Wno-register
)
endif
()
if
(
ARG_NO_EXTRAS
)
return
()
endif
()
...
...
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