- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have Intel Fortran code that uses the fpp pre-processor.
In my code, I am using conditional compilation with pre-processor constructs like:
#if conApplicationName==1
....
#endif
I want to use similar logic in the Visual Studio Post-Build commands.
I have had success with a VB.NET project, using a Preprocessor Definition:
conVB6ApplicationName="HIPAVE"
Then, the Post-Build command:
if "$(DefineConstants.Contains('HIPAVE'))" == "True" copy "$(TargetPath)" "$(TargetDir)HIPAVE Launcher\HIPAVE_Floating_Launcher.exe" /Y
worked.
But now my Project is Intel Fortran.
Again, my Preprocessor Definition:
conVB6ApplicationName="HIPAVE"
But now, I get this warning:
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(DefineConstants.Contains('HIPAVE')
Is there some other property in a VS project where I can define conVB6ApplicationName="HIPAVE"?
Regards,
Leigh
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just for the record, I found a solution with help from chatGPT.
The build commands do not see the Intel Fortran preprocessor variables.
You need to set your variables in the build command.
Something like this works:
SET YourCustomVariable=APSDS
IF "%YourCustomVariable%" == "APSDS" (
copy "$(TargetPath)" "$(TargetDir)APSDS_Deleteme.exe" /Y
)
Performing Post-Build Event...
SET YourCustomVariable=APSDS
IF "%YourCustomVariable%" == "APSDS" (
copy "C:\Users\Administrator\source\repos\Conditional Post-Build Test\Debug\Conditional Post-Build Test.exe" "C:\Users\Administrator\source\repos\Conditional Post-Build Test\Debug\APSDS_Deleteme.exe" /Y
)
1 file(s) copied.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page