That doesn't work, I still end up with the \$ in the CTestTestfile.cmake and the variable unevaluated at runtime.
I've been trying all day to get ctest to read a CTestCustom.cmake file but I can't seem to get that working either - how do you use ctest_read_custom_files in a generator command? On Sat, Mar 7, 2015 at 11:44 AM, Mark Abraham <[email protected]> wrote: > > > On Sat, Mar 7, 2015 at 4:51 PM, Jim Edwards <[email protected]> wrote: > >> 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} ) >> > > Try > > set(REQUIRED_OPTION "--block \$ENV{COBALT_PARTITION}") > > That way you inhibit the variable expansion at CMake time, but the output > of the expansion has had a level of indirection removed, in the usual > shell-script way. Then I expect add_test will look like your hand-edited > version. > > set(EXE_CMD ${RUNJOB} ${RUNJOB_NPF} ${REQUIRED_OPTION} >> ${MPIEXEC_PREFLAGS} : ${_testExe} ${_testArgs}) >> > > FindMPI.cmake has a set of somewhat standard variable names that might > make sense for you to follow, even though that module probably won't be > useful for finding runjob, because it might do so at some future time. > > Mark > > >> Any ideas? >> >> >> -- >> Jim Edwards >> >> CESM Software Engineer >> National Center for Atmospheric Research >> Boulder, CO >> >> -- >> >> 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 >> > > > -- > > 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 > -- Jim Edwards CESM Software Engineer National Center for Atmospheric Research Boulder, CO
-- 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
