PDA

View Full Version : Conditional Pragma?



NewsArchive
01-18-2016, 05:23 AM
I am attempting to have a conditional CODESIGN_SHA pragma in the code
where code signing would be either just SHA1 or SHA1/2.

Just for testing, I used the following. The actual test will be more
involved, the file exist is just for testing<g>.

#iffile "W:\CodeSign.txt" doesn't exist Then
#msg "CODESIGN.TXT Does Not Exist"
#pragma CODESIGN_SHA = "1"
#else
#msg "CODESIGN.TXT Does Exist"
#pragma CODESIGN_SHA = "12"
#end

It properly shows the "#msg" based on if file is there or not but the
#pragma do not work. Instead it seems to always pickup and use the
last #pragma regardless if the test,

Is this correct behavior and if so, is there a way to accomplish the
objective?

Barton Whisler
(retired<g>)

NewsArchive
01-19-2016, 03:01 AM
Barton,

> Is this correct behavior and if so, is there a way to accomplish the
> objective?

Conditional pragmas are not possible. A compiler pragma is set before the
source code is compiled!

Friedrich

NewsArchive
01-19-2016, 03:02 AM
In your case, it's always set to "dual" code-signing (#pragma CODESIGN_SHA =
"12").

Friedrich

NewsArchive
01-19-2016, 03:07 AM
Similar to this:

http://www.lindersoft.com/forums/showthread.php?35171-pragma-problem&p=63590#post63590

Friedrich

NewsArchive
01-19-2016, 03:08 AM
> I am attempting to have a conditional CODESIGN_SHA pragma in the
> code where code signing would be either just SHA1 or SHA1/2.

BTW, what you can do is to create a "Release" or Compiler Variable SKU and
use this to set the code-signing method at compile time!

Friedrich

NewsArchive
01-19-2016, 03:09 AM
Perfect - Thanks!!!!!!!

Barton Whisler
(semi-retired<g>)

NewsArchive
01-19-2016, 03:09 AM
Have it setup and works great but got one more question.

If the "Compile" button is clicked instead of one of the drop down
options, it appears that the compiler variable (SHA in this case) is
zero.

Is there a way to set what happens with this variable if the Compiler
Button is clicked instead? In my case I would like for it to be dual
compile, thus value of "12". I am concern that the owner is going to
click that button and not realize that he only SHA-1 signed it.

Bart

Barton Whisler
(semi-retired<g>)

NewsArchive
01-19-2016, 03:10 AM
Never mind, figured it out. Create and set "Compiler Variable" to my
default and then add same variable name in Release for my alternative.

Bart

Barton Whisler
(semi-retired<g>)

NewsArchive
01-19-2016, 03:11 AM
> Never mind, figured it out. Create and set "Compiler Variable" to my
> default and then add same variable name in Release for my alternative.

Perfect!

Friedrich