Author Topic: Same source file, two different compiles within one project  (Read 4471 times)

Offline Miq

  • Single posting newcomer
  • *
  • Posts: 3
I am currently trying to migrate a slightly tricky Makefile into C::B. One "feature" therein is the generation of two different executables from the same sources, with only preprocessor defines changed (oh, code is in C, by the way). So if a source file is changed, two different object files have to be generated and linked against the two respective executables. The Makefile solves this task by forcing the file compile into two differently named object files, and linking the correct ones into the executables.

How do I do this in C::B?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Same source file, two different compiles within one project
« Reply #1 on: May 23, 2007, 11:44:49 am »
How do I do this in C::B?
- don't use your Makefile ;-)
- create a project
- create two targets (for each executable, different executable name, different object path)
- add all source files to both targets
- setup in the project options the common (same) compiler/linker options
- setup in the target options the different compiler/linker options (in your case: the define)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Miq

  • Single posting newcomer
  • *
  • Posts: 3
Re: Same source file, two different compiles within one project
« Reply #2 on: May 23, 2007, 11:59:14 am »
...
- create two targets (for each executable, different executable name, different object path)
...

That was the bit missing - thank you!  :D