blob: 5df01c63968b107601d7e7769c8b306623e4d082 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
cmake_minimum_required(VERSION 3.15)
project(TestRequiredArtifacts LANGUAGES C)
include(CTest)
if(CMake_TEST_FindPython2)
find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
message (FATAL_ERROR "Failed to find Python 2")
endif()
set(USER_LIBRARY "${Python2_LIBRARY_RELEASE}")
set(USER_INCLUDE_DIR "${Python2_INCLUDE_DIRS}")
else()
set(USER_LIBRARY "/path/to/invalid${CMAKE_C_LINK_LIBRARY_SUFFIX}")
set(USER_INCLUDE_DIR "/path/to/invalid/dir")
endif()
set(components Interpreter Development)
if (CMake_TEST_FindPython3_SABIModule AND WIN32)
list (APPEND components Development.SABIModule)
endif()
find_package(Python3 REQUIRED COMPONENTS ${components})
if (NOT Python3_FOUND)
message (FATAL_ERROR "Failed to find Python 3")
endif()
add_test(NAME FindPython.RequiredArtifacts.Interpreter.VALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Interpreter.VALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_INTERPRETER=ON
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Interpreter.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Interpreter.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INTERPRETER=ON
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}-bad${CMAKE_EXECUTABLE_SUFFIX}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Library.VALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Library.VALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_LIBRARY=ON
"-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Library.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Library.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON
"-DPython3_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Include.VALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Include.VALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_INCLUDE=ON
"-DPython3_INCLUDE_DIR=${Python3_INCLUDE_DIRS}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Include.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Include.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INCLUDE=ON
"-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Interpreter-Library.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Interpreter-Library.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INTERPRETER=ON -DCHECK_LIBRARY=ON
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}"
"-DPython3_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.Library-Include.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/Library-Include.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON -DCHECK_INCLUDE=ON
"-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}"
"-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
if (CMake_TEST_FindPython3_SABIModule AND WIN32)
add_test(NAME FindPython.RequiredArtifacts.SABILibrary.VALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/SABILibrary.VALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=TRUE -DCHECK_SABI_LIBRARY=ON
"-DPython3_SABI_LIBRARY=${Python3_SABI_LIBRARY_RELEASE}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
add_test(NAME FindPython.RequiredArtifacts.SABILibrary.INVALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/RequiredArtifacts/Check"
"${CMake_BINARY_DIR}/Tests/FindPython/RequiredArtifacts/SABILibrary.INVALID"
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON
"-DPython3_SABI_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
|