On Tuesday 09 November 2010 17:35:08 Michael Hertling wrote: > On 11/07/2010 03:37 PM, luxInteg wrote: > > On Sunday 07 November 2010 11:34:47 Richard Wackerbarth wrote: > >> First let me suggest that you word your request in a more complete > >> manner. What "does not work"? > > > > cant get an executable generated because the 'COMMAND' syntax is > > incorrect" so could you suggest the correct syntax please? > > > >> What were you expecting and what did you get? > >> It is difficult, if not impossible, for us to guess. > >> > >> I suspect that the problem is related to the ">" (specifying the output > >> file in Unix). Are you on a Un*x platform? > > > > yes linux > > > >> Remember that CMake uses a > >> different syntax because it assumes that the platform may not be > >> Unix-based. > >> > >> I also have no idea just what "BouncyBall" is supposed to do > > > > generate BouncyBall.out > > > >> They look very much like a call to the > >> Unix "diff" command to verify that the output matches some previous > >> version (stored in BouncyBall.out) > > > > correct > > > > which requires the generation an executable file first. > > > >> Provide additional details. Then we may be able to be more helpful. > > > > DETAILS: as requested: > > add_executable(BouncyBall BouncyBall.c) > > find_library(OLD_LIBRARY OLD) > > target_link_libraries(BouncyBall ${OLD_LIBRARY}) > > COMMAND(./BouncyBall > my_BouncyBall.out > > > > - diff BouncyBall.out my_BouncyBall.out) > > > > what is needed:- > > > > > > a) syntax for generating BouncyBall executable with oppropriate linking > > to ${OLD_LIBRARY} > > The ADD_EXECUTABLE(), FIND_LIBRARY() and TARGET_LINK_LIBRARIES() > commands look good, provided the library OLD is actually found. > > > b) syntax within cmake for executing BouncyBall executable and > > diffing output to 'existing' outputfile > > > > i.e this bit:- > > ( > > > > COMMAND(./BouncyBall > my_BouncyBall.out > > > > - diff BouncyBall.out my_BouncyBall.out ) > > ) > > Here, you might use a test driven by a simple CMake script: > > CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) > PROJECT(BOUNCYBALL C) > ENABLE_TESTING() > FILE(WRITE ${CMAKE_BINARY_DIR}/bouncyball.out "bouncyball\n") > FILE(WRITE ${CMAKE_BINARY_DIR}/bouncyball.cmake " > EXECUTE_PROCESS( > COMMAND \${EXEC} COMMAND diff - \${FILE} RESULT_VARIABLE RESULT > ) > IF(NOT RESULT EQUAL 0) > MESSAGE(FATAL_ERROR) > ENDIF() > ") > FILE(WRITE ${CMAKE_BINARY_DIR}/bouncyball.c " > #include <stdio.h> > int main(void){ > printf(\"bouncyball\\n\"); > return 0; > } > ") > ADD_EXECUTABLE(bouncyball bouncyball.c) > ADD_TEST(NAME bouncyball > COMMAND ${CMAKE_COMMAND} > -DEXEC=$<TARGET_FILE:bouncyball> > -DFILE=${CMAKE_BINARY_DIR}/bouncyball.out > -P ${CMAKE_BINARY_DIR}/bouncyball.cmake > ) > > After configuration, if you edit bouncyball.out you can see the test > pass or fail, depending on its contents; use "make test" or "ctest". > thanks for your help, I have gone off on a tanget at present but as soon as things turn back in this direction I will give it a whirl and report my findings.
_______________________________________________ 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