Code::Blocks Forums

User forums => Help => Topic started by: moloh on May 12, 2006, 09:27:09 pm

Title: Custom target
Post by: moloh on May 12, 2006, 09:27:09 pm
Hello!
I need to create some symlinks to header files (they are scattered in many directories, but finally, after install should be accessible from single directory) and i don't know how i can do that. The best would be if i could create a "custom" target (there exist Command only type, but i don't know how exactly i can use it), select files and perform custom commands like: ln -sf $(file_absolute_path) $(output_include_dir)/$(file_name) for every file in this target.

I spotted few possibilities to do that, but have no idea how to use them:

If You have some hints i would appreciate it.
Title: Re: Custom target
Post by: Michael on May 12, 2006, 10:38:34 pm
Hello,

I am not sure to have fully understood, but with ln you can create symbolic links and put them into a single directory. Then you can try to use that directory for include headers. You can have a look at man ccache to know how to build symbolic links.

Best wishes,
Michael
Title: Re: Custom target
Post by: moloh on May 12, 2006, 10:52:32 pm
I am not sure to have fully understood, but with ln you can create symbolic links and put them into a single directory. Then you can try to use that directory for include headers. You can have a look at man ccache to know how to build symbolic links.

Yes, i can do it myself by hand, but i want to have it done automatically, during build, before compilation. The best would be first check if links exist and if not do the work.
Title: Re: Custom target
Post by: Michael on May 12, 2006, 11:09:24 pm
I am not sure to have fully understood, but with ln you can create symbolic links and put them into a single directory. Then you can try to use that directory for include headers. You can have a look at man ccache to know how to build symbolic links.

Yes, i can do it myself by hand, but i want to have it done automatically, during build, before compilation. The best would be first check if links exist and if not do the work.

May be you can try to use the pre-build steps (Project-->Build options-->Commands).

Best wishes,
Michael
Title: Re: Custom target
Post by: moloh on May 12, 2006, 11:28:14 pm
May be you can try to use the pre-build steps (Project-->Build options-->Commands).
I try it, but these command are only executed once globally, so to use this i would have to input all header link commands there separately (it would be very long list).
I found out that i can create a custom compile command for each needed header file separately (Options for files), set priority, check Compile box and insert custom compile option... but this is pain. I have more than 50 headers to do that and if i want to rearrange sources in future? I would have to modify each of these commands independently.
Another problem is config.h file, how can i parse sth like that? Till now i use cmake for management, makefile creation and config.h file creation.

But still i have some other questions. In target options, selected build target files are used as a target dependencies? If i deselect some headers and make changes in them, do sources that depend on these headers would be recompiled?