I need to enable C++11 features when using
CreateLibrary. I need a solution which will work with (almost) any compiler on any operating system.
Generally, this can be done by passing a certain flag to the compiler. In principle, the syntax will depend on the specific compiler. Clang and GCC take
-std=c++11 while MSVC needs no special flag. The Intel compiler needs different flags depending on operating system (according to the documentation—I haven't had the chance to try it out). I am not sure what other compilers Mathematica may support.
The challenge is to select the correct compiler option to use. Thus the main part of my question is:
Given access to all
CreateLibrary options (such as
"Compiler", etc.), how can I robustly figure out which compiler it is going to use, so I can append the correct compiler flag?
Note: For my use case it can be assumed that we are compiling C++ code, not C code.