Remove -march=native/-mcpu=native default compilation flags.
Indeed this is making the assumption that the build machine is also the same (or in the case of -mcpu similar to) the CPU found on the run machines. In the general cases of distributions where compiling happens once and the file is binary is distributed on many other machines, this is actually a wrong assumption.
I know that most likely this pull request will be rejected as is. If that is the case, then what do you think about adding one CMAKE variable to conditionally enable these flags (and without cross-compiling) ? As really, if you are in the case of a distribution, you really don't want that behavior.
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Coverage increased (+0.1%) to 99.879% when pulling c944f0e997969ba4b1bdcae3f7115060f85716cb on Romain-Geissler-1A:remove-march-native-flag into ce81bc9edfe773667a7a4454ba81dac72ed4364c on Tencent:master.
RapidJSON is header-only library. There is no binary distribution. The build is only for unit tests and performance tests.
This PR fixes #1816. Without this change, it isn't possible to install rapidjson on ARM (for example, Apple's new M1 laptops).
I'm also experiencing issues with -march=native being set when compiling on Apple Silicon. What can we do about this?