On 30.07.2017 03:22, Kris Thielemans wrote:
Hi
I’m trying to add to the PYTHONPATH for a test that uses Python. I do
that using set_test_properties. When using the makefile generator, I
need to add ${CMAKE_CURRENT_BINARY_DIR}. However, for Visual Studio I
also need to add for instance ${CMAKE_CURRENT_BINARY_DIR}/Release.
My current CMakeLists.txt works only on Windows and when building
Release mode:
add_test(${name} “${PYTHON_EXECUTABLE}" ${testfile} )
set_tests_properties ( ${name} PROPERTIES ENVIRONMENT
"PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Release\;${CMAKE_CURRENT_BINARY_DIR}")
I have 2 problems:
* How do I figure out which configuration is being used?
$<TARGET_FILE_DIR:target}> doesn’t seem to work inside
set_test_properties (it just gets passed verbatim)
Try using the NAME/COMMAND signature of add_test() e.g.
add_test(NAME ${name} COMMAND “${PYTHON_EXECUTABLE}" ${testfile})
It should enable generator expression processing in test properties.
Nils
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake