Reputation: 347
I have a CMakeLists.txt in which i have to pass a Python script consisting of test cases by making use of add_test
as follows:
add_test( NAME My_test COMMAND python ${CMAKE_CURRENT_LIST_DIR}/win_testing/test.py )
How can i set and open "test.py" with Python version 2.7.2?
Upvotes: 2
Views: 2256
Reputation: 10165
Use FindPythonInterp module to get path of Python executable to be used in add_test
find_package(PythonInterp 2.7 REQUIRED)
...
add_test(NAME My_test COMMAND ${PYTHON_EXECUTABLE} ... )
Make sure that find_program called inside FindPythonInterp.cmake can found Python 2.7.2
Upvotes: 1