Author Topic: Custom target  (Read 4190 times)

moloh

  • Guest
Custom target
« 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:
  • commands only target type - where i put these commands, if this is Commands tab (Pre-build steps, Post-build steps) in Project build options then it would be hard to do it as these are global commands, done once, not for each single file in target.
  • compiler type - define new compiler type with my custom commands to create symlinks, but how can i do it?
  • build scripts - this looks very promising, but i don't know how to use it, found no documentation or examples. But here could be the same problem as with first resolution, i don't know if script is executed for each of target files separately or only once at start or end.

If You have some hints i would appreciate it.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Custom target
« Reply #1 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

moloh

  • Guest
Re: Custom target
« Reply #2 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.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Custom target
« Reply #3 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

moloh

  • Guest
Re: Custom target
« Reply #4 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?