COMP: Constrain x86_64 optimization flags according to CMAKE_SYSTEM_PROCESSOR#2459
Conversation
…ROCESSOR CMAKE_SYSTEM_PROCESSOR defines the target compilation architecture. When we want x86_64 optimizations, e.g. -march=corei7, only add these flags when building for this architecture. On Linux/macOS (GCC/AppleClang), CMAKE_SYSTEM_PROCESSOR is "x86_64" and on Windows (Visual Studio) it is "AMD64".
|
Introspecting the system processor is antithetical to cross compiling. It'd be nice to see less of it, not more of it. As you know, I just got rid of a problematic case the other day: #2450 It's still setting
It seems to be a choice that is best for no one, and best left to the person building the code. |
Note that CMAKE_SYSTEM_PROCESSOR is not the host system processor. This improves cross compilation support -- it is not antithetical to cross compliing.
We do want the person building the code to be able to choose their optimization flags, but we also want good, sensible defaults. Enabling SIMD support on x86_64 is a good default. |
…-flags-check COMP: Constrain x86_64 optimization flags according to CMAKE_SYSTEM_PROCESSOR
CMAKE_SYSTEM_PROCESSOR defines the target compilation architecture. When
we want x86_64 optimizations, e.g. -march=corei7, only add these flags
when building for this architecture. On Linux/macOS (GCC/AppleClang),
CMAKE_SYSTEM_PROCESSOR is "x86_64" and on Windows (Visual Studio) it is
"AMD64".