title: Using devenv to pass preprocessor variables to Intel Fortran compiler
body: <p>I'm using VS 2008 with Intel(R) Fortran Compiler version 10.1.025.</p>
  
  <p>To build my solution I'm using a batch file with the following syntax:</p>
  
  <p>devenv /rebuild "Release|Win32" "c:...\solution.sln" /Project "ProjectName_InTheSolution"</p>
  
  <p>Using the configuration "Release|Win32" I specify, in VS ProjectProperties->Fortran->Proprocessor->Preprocessor Definitions the value "test".</p>
  
  <p>Inside my code I'm testing if the "test" variable is define which is working everything correctly.</p>
  
  <p>Any one know any way to change the "Preprocessor Definitions" of the fortran compiler using the command line ? I want to add also the value "commandLine" so would be "test;commandline" in the "Preprocessor Definitions".</p>
  
  <p>Some notes:</p>
  
  <pre><code>1) I have to use the devenv.exe
  2) I don't want to change neither the source code or the project file prior the compilation
  3) I can use environment variable to pass option (if there is any way, I try the CL but didn't work)
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <hr>
  
  <p>Thanks for your answer but maybe I didn't understand completely your solution, but this is what I tried:</p>
  
  <p>1)I change the "Additional Options" (AO) to /Dtest and:
     1.1) If I compile from the Visual Studio or Command Line the check "!DEC$ IF DEFINED (test)" is true</p>
  
  <p>2)I changed the AO to "$(DEFINE)" and:
     2.1) From Visual Studio I see warnings: "command line warning #10161: unrecognized source type '$(DEFINE)'; object file assumed  ifort   " and the check "!DEC$ IF DEFINED (test)" is false
     2.2) I add the Define variable to "User environment variables", same error from 2.1</p>
  
  <p>3) I change the AO to "/D$(DEFINE)" I got an error "Bad syntax, '=' expected while processing '@$(define)'  fortcom "</p>
  
  <p>4) I change the AO to "$(DEFINE)" and SET DEFINE=/test, and didn't work either, the "!DEC$ IF DEFINED (test)" is false</p>
  
  <p>@cup I think I need to understand a little better your solution, if you please could give me an additional information about your solution would be very appreciated.</p>
  
  <p>What I'm trying to do is this:</p>
  
  <pre><code>program main
  integer:: ii
  !DEC$ IF DEFINED (test) 
  ii = 72
  !DEC$ ENDIF
  !DEC$ IF DEFINED (test2) 
  ii = 80
  !DEC$ ENDIF
  print *, "this is up to column ", ii
  end
  </code></pre>
  
  <p>Now I want to control from the command line which part of code will be compiled, doing something like this:</p>
  
  <pre><code>1) from the command line:  set define=test
  2) devenv elephant.sln /build
  3) run debug/elephant.exe  -&gt; get "72"
  
  4) from the command line:  set define=test2
  5) devenv elephant.sln /build
  6) run debug/elephant.exe  -&gt; get "80"
  </code></pre>
  
  <p>This is possible ?
  Thanks in advance,
  rui</p>