1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright Contributors to the OpenEXR Project.
4 if(TARGET Python2::Interpreter)
5 add_test(PyImath.PyImathTest_Python2
6 ${Python2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in
8 set_tests_properties(PyImath.PyImathTest_Python2 PROPERTIES
9 ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python2_VERSION_MAJOR}_${Python2_VERSION_MINOR}"
13 if(TARGET Python3::Interpreter)
14 add_test(PyImath.PyImathTest_Python3
15 ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyImathTest.in
17 set_tests_properties(PyImath.PyImathTest_Python3 PROPERTIES
18 ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/python${Python3_VERSION_MAJOR}_${Python3_VERSION_MINOR}"
21 add_executable(PyImathTestC main.cpp testStringTable.cpp)
23 target_link_libraries(PyImathTestC
25 Imath::PyImath_Python${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}
27 Boost::${PYIMATH_BOOST_PY_COMPONENT})
28 set_target_properties(PyImathTestC PROPERTIES
29 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
32 add_test(NAME Imath.PyImathTestC COMMAND $<TARGET_FILE:PyImathTestC>)
33 set(PYTHONPATH ${CMAKE_BINARY_DIR}/python${Python_VERSION_MAJOR}_${Python_VERSION_MINOR})
34 set_tests_properties(Imath.PyImathTestC PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHONPATH})