Hi all
I've managed to solve my own question. The trick is to use the
$<CONFIGURATION> generator expression. Here is the correct line (this time
with the add_test command included, which I had forgotten to copy-paste
before, which no doubt confused everyone).
add_test(NAME SIRF_TESTS
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/SIRF-prefix/src/SIRF-build/)
Best wishes
Kris
From: Kris Thielemans
Sent: 23 December 2017 09:12
To: 'CMake Mail List' <[email protected]>
Subject: how to add a test that calls ctest
Hi
We have a superbuild-type project
https://github.com/CCPPETMR/SIRF-SuperBuild where we want to add tests that
call ctest for the dependent projects. We do this as
COMMAND ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/SIRF-prefix/src/SIRF-build/)
which works fine when using Makefiles, but fails with Visual Studio as we
don't pass the "-C config" flag. So how do we put this in? I tried
COMMAND ${CMAKE_CTEST_COMMAND} -C ${CMAKE_CFG_INTDIR} -VV
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SIRF-prefix/src/SIRF-build/)
But this gives me errors like
1: 4: Test command: NOT_AVAILABLE
1: Test not available in configuration "$(Configuration)".
Best wishes
Kris Thielemans
Reader in Medical Imaging Physics at University College London
--
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:
https://cmake.org/mailman/listinfo/cmake