GreatCMakeCookOff icon indicating copy to clipboard operation
GreatCMakeCookOff copied to clipboard

Add an example for setup_pytest

Open jorgehatccrma opened this issue 9 years ago • 2 comments

This is not an issue, but a question.

I'm trying to use add_pytest, but I can't understand what py.test.sh is (the second argument to pass to setup_pytest). An example of that file would be very helpful.

Cheers!

jorgehatccrma avatar Oct 11 '16 16:10 jorgehatccrma

It's a path to a bash script that is created by the function. It sets up the python environment to read package that are downloaded as part of the build process (for instance pytest, if it is not installed globally).

You're right, it needs an example :)

In fact, it should have a default value and be hidden from casual users.

For now, you could look here: https://github.com/basp-group/sopt/blob/master/cmake_files/python_dependencies.cmake

At the end of the file, we setup the pytest part of the environment.

mdavezac avatar Oct 12 '16 16:10 mdavezac

I also ran into problems due to the scarce documentation. I haven't checked if the first argument is right (probably isn't) because I didn't get to install yet. But py.test.sh needs to have a directory

setup_pytest("${CMAKE_CURRENT_BINARY_DIR}" "py.test.sh")

I get

CMake Error at /home/beaujean/software/GreatCMakeCookOff/scripts/EnvironmentScript.cmake:123 (file):
file COPY given no DESTINATION

but with

setup_pytest("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/py.test.sh")

it works

fredRos avatar Mar 24 '17 12:03 fredRos