[CMake] Argument passing to shell script through cmake

Denis Scherbakov denis_scherbakov at yahoo.com
Thu Mar 26 05:45:17 EDT 2009


You could add your custom target and specify that some target depends on it.

ADD_CUSTOM_TRAGET(TargetScript COMMAND shell-script.sh)
ADD_EXECUTABLE(TargetExe ${TARGET_SRCS})
ADD_DEPENDENCIES(TargetExe  TargetScript)

You could also use ADD_CUSTOM_COMMAND and it's PRE_BUILD/PRE_LINK feature.

ADD_CUSTOM_COMMAND(TARGET TargetExe COMMAND shell-script.sh)

Please also be aware, that shell scripts are not portable unless they are CMake scripts.

Denis

> > Did you try EXECUTE_PROCESS and ADD_CUSTOM_COMMAND?
> >
> > Denis
> >
> 
> I tried execute process it works but hte problem is that it
> runs at compile
> time itself i want that script wil run at build time.
> 
> With add_custom_command iam not able to give something in
> OUTPUT since the
> script simply display a message.
> 
> Another problem is that  with other add_custom_command wher
> iam specify
> OUTPUT which is something like files then its compulsory to
> link them with
> some target but i simply want to generate it. also unless
> an until u cant
> link to some target and run "make <target_name>
> add_custom_command willnot
> run.
> 
> I want to simply run the make command and want to execute
> teh command but
> this OUTPUT as well as linking it with some target really
> creates a lots of
> problem to me..
> 
> Is there any way by which if want to simply executes a
> command it runs on
> doing "make" only. add _custom _commadn demands
> OUTPUT which is not a
> problem but the tresult will not come unless u link it with
> some target and
> then built that target for that u have to give "make
> <target_name>. i just
> want to run make...
> 
> I hope i make clear my problem...
> Let me know how to get rid of it...



      


More information about the CMake mailing list