UCL / GreatCMakeCookOff

Bunch of CMake pain in the baker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an example for setup_pytest

jorgehatccrma opened this issue · 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!

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.

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