Author Topic: compile with different build options(flags)  (Read 3584 times)

Offline linyx

  • Single posting newcomer
  • *
  • Posts: 2
compile with different build options(flags)
« on: May 22, 2016, 01:52:43 am »
Hi, everyone:

Recently I switched from Vim to code::blocks for debugging fortran (I am done with print, print, print,,,,),  but I met a problem in which I cannot solve because of new to CB.

The problem is, say if I have two folders containing the source code in one project to compile. In the first folder I need to add flags like -cpp -O3 or sth, but in the second folder I need to place another flag like -fdefault-real-8, but this is not applicable to the source code in the first folder. How can I define different build options for different  code in one project?

Yuxiang


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: compile with different build options(flags)
« Reply #1 on: May 22, 2016, 10:39:53 am »
4 options:
1. use different project and set the dependencies between them
2. use targets (see the codeblocks-unix.cbp in our source for example)
3. modify the compile command per file (right click on the file -> properties -> advanced -> use custom command)
4. use a makefile and setup a custom makefile project
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline linyx

  • Single posting newcomer
  • *
  • Posts: 2
Re: compile with different build options(flags)
« Reply #2 on: May 23, 2016, 01:53:51 am »
Thank you for your reply. Actually I used the first option you suggest to solve this problem.

Thank you very much