Intel oneAPI compiler flag syntax
The Intel oneAPI compiler
flags
are generally somewhat distinct on Windows and Linux.
However, there is a platform-agnostic syntax that can be used to specify the flags in a way that works on Windows and Linux without if-else logic needed in the build system (e.g. CMake).
The oneAPI OS-agnostic compiler flag syntax is as follows:
-option:value
Where option is the name of the compiler flag and value is the value to be passed to the flag.
Observe this is a hybrid of Linux options that use - as a prefix, and Windows options that use : as a separator between the option and its value.
This syntax allows developers to write build scripts and command lines that are portable across both Windows and Linux without needing to change the syntax of the compiler flags.
This method is used internal to CMake for example, as a demonstration of its robustness.