User forums > Using Code::Blocks

Automaticlly building all files in folder without a custom makefile?

(1/4) > >>

Eriond:
Hi,

As far as I understand it, C::B geneates its own makefile at compile time, based on which files are in your project. I have a script that generates some files at compile time, and I'd like to find a way to add these files to the makefile that C::B generates, without actually going through the trouble of adding in the files to the project everytime a new one's generated. It seems that using a custom makefile might be somewhat of a hassle (I'm not so experienced with the things; all I know is configure, make, and make install), but if it's easier than I'm thinking, please tell me, and I guess I'll use that instead.

Basically, my question is, does anyone know if it's possible to add all *.cpp files in a particular directory (or any glob for that matter) to the build list at compile time?

Thanks

ouch:
codeblocks does not create it's own makefile it passes the commands to the toolchain on the fly as you have set the project up.

right click on your project and select add files recursively. That's probably what you want from the sounds of things.

Eriond:
Ah, okay.

As for recursively adding files, yeah, that's what I've been doing currently, it's just a hassle to keep doing it every time the generated file composition changes (plus, when certain generated files get deleted, I have to go in a remove them manually from the project, or they just sit as dead links in the project list). Is there any way to automate this, or, at the very least, send a message to the C::B process to refresh its project list when the actual project file is modified (I could just append the files to the .cbp manually via a pre-build script, if this is possible, I guess)

ouch:
unfortunately the only way I know of would be to dive to scripting, or possibly making a custom makefile. Might even go for a strait command line shell/batch script as well depending on the situation.

But what are you building that is generating a bunch of cpp files anyway?

mirai:
You can ask your script to generate a couple of files with #include directives for all other generated files and then add only that couple to CB project.
Another solution is to use autogenerated CB project or CMake makefile that can be converted to both CB project and GNU makefile.

Navigation

[0] Message Index

[#] Next page

Go to full version