Showing results for 
Search instead for 
Did you mean: 

How to change <inherit from project defaults> values

I have over 150 different Fortran projects and I would like to centralize their compiler options to a single spot.  If i do everything via command line, I can route the compiler options thru a single batch file and things are great.  However, I would like to duplicate this thru the Visual Studio IDE (VS 2017 if it matters).  Thru the IDE Property Pages I see there is a concept of "inherit from project defaults".  Can these "project defaults" be changed?  Can these "project defaults" be set singly and applied across many projects?  Is there another way that this could be done?



0 Kudos
1 Reply
Black Belt Retired Employee

I spent some time looking for where these default options came from. While I could find most everything else related to the Fortran project wizards, I didn't spot anything that looked like where the options came from. But even if I had, it would have affected new projects only.

What you CAN do is this. Create a text file in the project folder that has the compile options you want. If they are additional to the defaults fine, otherwise you may need to add negations of the default options. We'll call this fopts.txt, but you can call it anything you want.

Now in the project, go to Fortran > Command Line, and under Additional Options insert:


This causes the contents of fopts.txt to be appended to the ifort command after the regular options.

If you need linker options, you can do the same thing under Linker > Command Line.

You can't change everything this way, but it may be a help. If you want a central one, use @full-path-to-fopts.txt (I recommend a path that does not include spaces). 

If you want to change your existing projects you'd have to edit the .vfproj file, and for the line that starts "<Tool Name="VFFortranCompilerTool" " you would insert 'AdditionalOptions="@fopts.txt"'

Of course you could also edit the .vfproj file for each project and set the options as desired, but you'd then need to figure out what they are. Note that the options here are per-configuration, so you may need to edit multiple lines.

0 Kudos