I'm trying to use cmake for one of my projects.

As an experience, I have tried to mimick the gnu make check as indicated in the web pages, but decided for some reason to keep the "test" target name. But when, I issuing a ADD_DEPENDENCIES(test XXX) cmake tells me that there is no dependency name "test", but when I'm trying to add one, then it claims there is already an existing "test" dependency.... confusing !! I also played with a DEPENDS set_test_property
(not documented) which does not work either...

Any help will be appreciated. I'm sure someone already ran in this problem and solved it.

   regards,

      Theo.

cmake --version
cmake version 2.6-patch 3

############# CMakelists.txt (somewhat simplified) ##################

#ADD_CUSTOM_TARGET(test COMMAND ${CMAKE_TEST_COMMAND})

MACRO(ADD_EXECUTABLES)
   FOREACH (executable ${ARGN})
       #ADD_EXECUTABLE(${executable} EXCLUDE_FROM_ALL ${executable}.C)
       ADD_EXECUTABLE(${executable} ${executable}.C)
       TARGET_LINK_LIBRARIES(${executable} ${libraries})
       #ADD_DEPENDENCIES(test ${executable})
   ENDFOREACH ()
ENDMACRO()

ADD_EXECUTABLES(Arith Diag )

MACRO(MATHS_TEST NAME PROG_NAME PROG_ARGS)

   IF (WIN32)
       SET (TEST_DIR ${EXECUTABLE_OUTPUT_PATH})
   ELSE ()
       SET (TEST_DIR ${CMAKE_CURRENT_BINARY_DIR})
   ENDIF ()

   SET (EXECUTABLE ${TEST_DIR}/${PROG_NAME}${CMAKE_EXECUTABLE_SUFFIX})
   ADD_TEST(${NAME}_TEST
            ${CMAKE_COMMAND} -D TEST_PROGRAM=${EXECUTABLE}
                             -D TEST_ARGS=${PROG_ARGS}
                             -D TEST_OUTPUT=${TEST_DIR}/${PROG_NAME}.out
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/results/${PROG_NAME}.out -P ${CMAKE_SOURCE_DIR}/tests/runTest.cmake ) # To compare output to reference file
   ADD_TEST(${NAME} ${EXECUTABLE} ${PROG_ARGS}) # To perform memcheck tests
   #SET_TESTS_PROPERTIES(${NAME} PROPERTIES DEPENDS ${EXECUTABLE})
SET_TESTS_PROPERTIES(${NAME}_TEST PROPERTIES PASS_REGULAR_EXPRESSION "Success")
ENDMACRO()

MATHS_TEST(ARITH Arith)
MATHS_TEST(DIAG Diag)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to