[CMake] runtime env variables in ctest

Jim Edwards jedwards at ucar.edu
Sat Mar 7 10:51:00 EST 2015


I'm trying to pass a variable to ctest that will only be evaluated at
runtime.
If I hand edit the add_test command I can get it to work, the hand edited
add test looks like:

add_test(piotest "runjob" "--np" "4" "--block" "$ENV{COBALT_PARTITION}" ":"
"/gpfs/piotest")

​But I can't get cmake to generate this line for me, it either evaluates
$ENV{COBALT_PARTITION} at build time or it escapes the $ so that I have:

add_test(piotest "runjob" "--np" "4" "--block" "\$ENV{COBALT_PARTITION}"
":" "/gpfs/piotest")​

​and it never gets evaluated.    The statement I am working with is

     set(REQUIRED_OPTION --block \$ENV{COBALT_PARTITION} )

       set(EXE_CMD ${RUNJOB} ${RUNJOB_NPF} ${REQUIRED_OPTION}
${MPIEXEC_PREFLAGS} : ${_testExe} ${_testArgs})​


​Any ideas?​


-- 
Jim Edwards

CESM Software Engineer
National Center for Atmospheric Research
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150307/fbc4e583/attachment.html>


More information about the CMake mailing list