Author Topic: how to set different compiler options for some source files?  (Read 732 times)

Offline BDick

  • Single posting newcomer
  • *
  • Posts: 1
how to set different compiler options for some source files?
« on: August 01, 2018, 11:15:44 pm »
I have a project with some 300 FORTRAN and ca. 40 C-source files. I use the pgfortran compilers. while most of the FORTRAN files can be compiled with the same options, for a few (ca. 15) loop-unrolling and optimization must be switched off. Also, compilation of the C-files needs different defines on the command line.

My solution is to make the C-files into a different project that produces a library that is then linked within the fortran project. The fortran files with the different options i must compile manually, and then shift the object files into the project before linking.

I wonder whether there is a more elegant way of doing this, e.g. setting different compiler options for different sets of sources. Is this possible?

best regards, Bernhard

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11282
    • Travis build status
Re: how to set different compiler options for some source files?
« Reply #1 on: August 02, 2018, 01:07:38 am »
Yes, Right click on the file -> Properties -> Advanced -> Use custom command to build this file. But you should know the format of the original command in the fortran compiler. Probably you'll have to inspect the advanced settings of the fortran compiler in the compiler options.
(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!]