@@ -16,6 +16,29 @@ else()
16
16
cmake_policy (VERSION 3.18 )
17
17
endif ()
18
18
19
+ # Only needed for CMake < 3.5 support
20
+ include (CMakeParseArguments )
21
+
22
+ # Filter out items; print an optional message if any items filtered
23
+ #
24
+ # Usage:
25
+ # pybind11_filter_tests(LISTNAME file1.cpp file2.cpp ... MESSAGE "")
26
+ #
27
+ function (PYBIND11_FILTER_TESTS LISTNAME )
28
+ cmake_parse_arguments (ARG "" "MESSAGE" "" ${ARGN} )
29
+ set (PYBIND11_FILTER_TESTS_FOUND OFF )
30
+ foreach (filename IN LISTS ARG_UNPARSED_ARGUMENTS )
31
+ list (FIND ${LISTNAME} ${filename} FILE_FOUND )
32
+ if (FILE_FOUND GREATER -1 )
33
+ list (REMOVE_AT PYBIND11_TEST_FILES ${FILE_FOUND} )
34
+ set (PYBIND11_FILTER_TESTS_FOUND ON )
35
+ endif ()
36
+ endforeach ()
37
+ if (PYBIND11_FILTER_TESTS_FOUND AND ARG_MESSAGE )
38
+ message (STATUS "${ARG_MESSAGE} " )
39
+ endif ()
40
+ endfunction ()
41
+
19
42
# New Python support
20
43
if (DEFINED Python_EXECUTABLE )
21
44
set (PYTHON_EXECUTABLE "${Python_EXECUTABLE} " )
@@ -65,7 +88,7 @@ set(PYBIND11_TEST_FILES
65
88
test_eigen.cpp
66
89
test_enum.cpp
67
90
test_eval.cpp
68
- # AV this fails with PGI test_exceptions.cpp
91
+ test_exceptions.cpp
69
92
test_factory_constructors.cpp
70
93
test_gil_scoped.cpp
71
94
test_iostream.cpp
@@ -82,13 +105,12 @@ set(PYBIND11_TEST_FILES
82
105
test_pickling.cpp
83
106
test_pytypes.cpp
84
107
test_sequences_and_iterators.cpp
85
- # AV this fails with PGI test_smart_ptr.cpp
108
+ test_smart_ptr.cpp
86
109
test_stl.cpp
87
110
test_stl_binders.cpp
88
111
test_tagbased_polymorphic.cpp
89
112
test_union.cpp
90
- #AV this fails with PGI test_virtual_functions.cpp
91
- )
113
+ test_virtual_functions.cpp )
92
114
93
115
# Invoking cmake with something like:
94
116
# cmake -DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp" ..
@@ -98,11 +120,15 @@ if(PYBIND11_TEST_OVERRIDE)
98
120
set (PYBIND11_TEST_FILES ${PYBIND11_TEST_OVERRIDE} )
99
121
endif ()
100
122
101
- # Skip test_async for Python < 3.5
102
- list (FIND PYBIND11_TEST_FILES test_async.cpp PYBIND11_TEST_FILES_ASYNC_I )
103
- if ((PYBIND11_TEST_FILES_ASYNC_I GREATER -1 ) AND (PYTHON_VERSION VERSION_LESS 3.5 ))
104
- message (STATUS "Skipping test_async because Python version ${PYTHON_VERSION} < 3.5" )
105
- list (REMOVE_AT PYBIND11_TEST_FILES ${PYBIND11_TEST_FILES_ASYNC_I} )
123
+ if (PYTHON_VERSION VERSION_LESS 3.5 )
124
+ pybind11_filter_tests (PYBIND11_TEST_FILES test_async.cpp MESSAGE
125
+ "Skipping test_async on Python 2" )
126
+ endif ()
127
+
128
+ if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" )
129
+ pybind11_filter_tests (
130
+ PYBIND11_TEST_FILES test_exceptions.cpp test_smart_ptr.cpp test_virtual_functions.cpp MESSAGE
131
+ "Skipping tests that do not support PGI compilers" )
106
132
endif ()
107
133
108
134
string (REPLACE ".cpp" ".py" PYBIND11_PYTEST_FILES "${PYBIND11_TEST_FILES} " )
0 commit comments