My project has the following folderds:
<main_dir>\project.cbp
<main_dir>\src\main.c
<main_dir>\src\f1\f1.c
<main_dir>\src\f2\f2.c
For a strange reason (if you're curious I can tell you about) I need to store all object files in <main_dir>\OBJ folder, before linking. In other words, after compiling process the object files should be located in:
<main_dir>\obj\main.obj
<main_dir>\obj\f1.obj
<main_dir>\obj\f2.obj
Unfortunately, if I set <main_dir\obj folder as the output object folder in the project configuration settings, I have:
<main_dir>\obj\main.obj
<main_dir>\obj\f1\f1.obj
<main_dir>\obj\f2\f2.obj
I was thinking to copy object files from one folder to another one with post-build steps, but I think it's not possible to execute a command after each file compilation, only after linking process.
Another solution could be to change the compiler command from
$compiler $options $includes -o $object -c $file
to
$compiler $options $includes -o $objects_output_dir/$file_name.obj -c $file
But in this way the make process doesn't work. CodeBlocks compiles source files every time, even if they aren't changed since the last compilation time, because it couldn't find the object file where he supposed to be.
Any suggestions?