Disable optimizations per file or classes

Projucer doen’t supports to set optimizations per file.
My anticrack/licenser has many cpp/h files, and for security reasons, I do not want these files to be compiled with optimizations.
Before juce, I set this option from the IDE (vs/xcode) but now, every time
when I save the project with projucer I lost these options.

Ok, on visual studio “#pragma optimize( “”, off )” I think it will work. But with clang is not clear how to do that (Apple LLVM version 7.3.0 (clang-703.0.29)).

Any advice?

As a longshot/workaround would it work compile this part of the code as a static lib, then include/link to that?

mmmh, I would not risk, anyway I think that would be a mess in my case, for each product, a script generates the cpps files for the licenser.
pragma optimize does not works on clang? some talk about it works and others that it doent work.

I agree with martin, I think a static lib is the only way to go here.

I was thinking about this, and looking for alternatives, I have not found anything.

Thanks guys, I’ll do as static lib.

An other question, in the final compiled product, the static lib exported symbols can be striped?

Yes. A static lib is just an archive of .o files. So linking to a static lib or having the .cpp file in your project is really no different. If you strip your symbols at the very end of your build you will be fine.

Great! thanks!