[CMake] code::blocks project generated by cmake can not set arguments to main func

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jan 18 16:08:10 EST 2011


On Wednesday 22 December 2010, tfjiang wrote:
> Hi,everyone.
> While using cmake to generate a code::blocks project, I met a problem. I
> can not send argument to "int main(int argc,char *argv[])". I found some
> suggestions like that: add arguments in "projects-send programs'
> argument". It works in my testing  project which is directly generated
> by code::blocks, but if the project is generated by cmake, there is an
> error "You can not run a commands-only target".

Do you mean adding command line arguments when trying to execute the binary 
which you just built ?
If so, please add this as a bug to the cmake bug tracker and assign it to me:
http://public.kitware.com/Bug/

> Also, I notice that the cmake project doesn't contain Debug/Releas
> directories.

Yes. The C::B generator in cmake is based on the Makefile-generator, i.e. it 
generates makefiles and additionally the project file.  The makefile 
generators in cmake are one-configuration-generators, i.e. one configuration 
in one build tree, if you want to build in multiple configurations you have 
to set up one build tree for each configuration. 
This will result in one project file for each configuration. You should be 
able to load these multiple projects without problems in C::B.

Alex


More information about the CMake mailing list