[CMake] cmake my_BouncyBall

luxInteg lux-integ at btconnect.com
Sun Nov 7 09:37:57 EST 2010


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}
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 )
)

I hope I did provide   the example unix Makefile     that is being translated.

thanks
and
regards

> On Nov 7, 2010, at 6:08 AM, luxInteg wrote:
> > Greetings,
> > 
> > I am learning cmake. and I have taken the following from an old
> > Makefile:- INC = ../include/BouncyBall.h
> > 
> > BouncyBall: BouncyBall.c library $(INC)
> > 
> > 	${CC} ${CFLAGS}  -o BouncyBall BouncyBall.c ../lib/libOLD.a
> > 	./BouncyBall > my_BouncyBall.out  - diff BouncyBall.out
> > 	my_BouncyBall.out
> > 
> > and  'translated'   for cmake  as the following:-
> > -----------------------
> > 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)
> > 
> > install(TARGETS
> > BouncyBall
> > BouncyBall.out
> > my_BouncyBall.out
> > DESTINATION bin)
> > -----------------------
> > but it does not work
> > 
> > advice would be appreciated
> > 
> > sincerely
> > luxInteg


More information about the CMake mailing list