[cmake-developers] #16633: make CTestTestfile.cmake output dir possible to control

Brad King brad.king at kitware.com
Tue Feb 14 11:00:00 EST 2017


On 02/14/2017 10:54 AM, Giel van Schijndel wrote:
> I think it may be easier to do this inside CMake by generating the "new"
> form of the add_test() command in the produced CTestTestfile.cmake. From
> some experiments I've got the impression that that's always executed
> with paths relative to the directory containing the CTestTestfile.cmake.
> Although I only tested without setting the WORKING_DIRECTORY test
> property, I'm not sure how or if that property could work in this
> context.

IIRC add_test just runs the command as specified so a relative path
will be relative to the working directory.  That will break when using
the WORKING_DIRECTORY property.

Instead of generating a relative path for this use case, we could generate
an absolute path that is constructed with a variable like a literal
`${CMAKE_CURRENT_LIST_DIR}` in the CTestTestfile.cmake.  You'll have to
dig in a bit to figure out what the right placeholder is.  That way
CTest can construct the absolute path for the command line on the
CI system.

-Brad



More information about the cmake-developers mailing list