FindPython: add capability to select python version for the tests

This commit is contained in:
Marc Chevrier
2023-06-13 17:46:32 +02:00
parent 883cbf4171
commit 711d1da125
23 changed files with 526 additions and 395 deletions

View File

@@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.5)
project(TestNumPyOnly LANGUAGES C)
find_package(Python2 REQUIRED COMPONENTS NumPy)
find_package(Python3 REQUIRED COMPONENTS NumPy)
if(CMake_TEST_FindPython2_NumPy)
Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c)
target_compile_definitions (arraytest2 PRIVATE PYTHON2)
target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
find_package(Python2 REQUIRED COMPONENTS NumPy)
Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c)
target_compile_definitions (arraytest2 PRIVATE PYTHON2)
target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
endif()
if(CMake_TEST_FindPython3_NumPy)
find_package(Python3 REQUIRED COMPONENTS NumPy)
Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c)
target_compile_definitions (arraytest3 PRIVATE PYTHON3)
target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
endif()