[CMake] SOLUTION to <How to "install" then "test"?> problem
Denis Scherbakov
denis_scherbakov at yahoo.com
Mon Jan 30 15:16:21 EST 2012
Hi!
I just wanted to share my solution to <How to "install" then "test"?> problem.
As I alredy wrote: I have a big list of (say XML) files that executables expect
to be in strictly predetermined locations. Also we need to test executables after
install has been done. In other words, we need "gmake test" to depends on
"gmake install"
As Eric Noulard wrote, there is an open bug http://public.kitware.com/Bug/view.php?id=8438
and there is no direct way to do that. But there are some tricks. Here is my solution:
ADD_TEST(NAME "prepInstallDir"
COMMAND "${CMAKE_CTEST_COMMAND}"
--build-and-test "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
--build-noclean
--build-generator "${CMAKE_GENERATOR}"
--build-makeprogram "${CMAKE_MAKE_PROGRAM}"
--build-target install
--build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}"
--test-command "${CMAKE_COMMAND}" -E echo Install)
ADD_TEST(NAME "testFooExe" COMMAND FooExecutable)
SET_TESTS_PROPERTIES("testFooExe" PROPERTIES DEPENDS "prepInstallDir")
Denis
More information about the CMake
mailing list