- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable