[CMake] CTest question...

Eric NOULARD eric.noulard at gmail.com
Wed Nov 19 02:52:49 EST 2008


Le Tue, 18 Nov 2008 15:53:25 -0800 (PST),
BRM <bm_witness at yahoo.com> a écrit :

> Any info on this? Any better resources?

I think we miss informations about your particular configuration.
I do use ADD_TEST with no trouble.

See more question below: 

> From: BRM <bm_witness at yahoo.com>
> To: CMake <cmake at cmake.org>
> Sent: Monday, November 17, 2008 3:14:53 AM
> Subject: [CMake] CTest question...
> 
> I'd like to build a series of test using the CTest functionality in
> CMake. I have added ENABLE_TESTING() to the main CMakeLists, and was
> hoping to put the tests in their own sub-directories - as follows:
> 
> /
> /Tests
> /Tests/object
> /Tests/object/child-objects
> 
> I added the Tests directory in the root's CMakeLists.txt. I've
> created my first test (/Tests/object/objectTest) and tried adding it
> via ADD_TEST(objectTest ${EXECUTABLE_OUTPUT_PATH}/objectTest}) 

if objectTest is a target built in /Tests/object/objectTest
then you don't need the extra ${EXECUTABLE_OUTPUT_PATH} just put:

ADD_TEST(objectTest objectTest)

or in order to avoid name clash (I never experienced that but who knows)

ADD_TEST(objectTest_test objectTest)

> - no
> parameters needed (as described by
> http://www.vtk.org/Wiki/CMake_Testing_With_CTest). However, it's
> unable to find the test when I run "make test".

What is the exact error shown by "make test".
Do you get the same error when running

ctest 
 
> Note: I tried doing a MESSAGE() to find out the value of
> EXECUTABLE_OUTPUT_PATH and it seems to be NULL. Is that reall the
> right variable?

I don't think EXECUTABLE_OUTPUT_PATH is set by CMake unless you
decide to set it yourself. The default behavior of cmake is to put
built executable in CMAKE_CURRENT_BINARY_DIR.

Did you set EXECUTABLE_OUTPUT_PATH is your main CMakeLists.txt?

> The documentation on ENABLE_TESTING() mentions that CTest expects
> files in build's root directory. Does that also apply to ADD_TEST()?
> (no mention in ADD_TEST()'s documentation of this).

This is true for me but I do not use absolute file specification with
ADD_TEST, my ADD_TEST use target name previsouly built with
ADD_EXECUTABLE with no problem.


-- 
Erk


More information about the CMake mailing list