CMakeLists: improve detection of PowerPC architectures #319
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We’re building Boost for ppc32 and switching from b2 to CMake, but the CMake-based system defaults to using i386 asm files. A similar issue has been reported for ppc64le: #311
I noticed that in the list of default architectures there is “power”, but not “ppc32” or “ppc64”, which are the architecture names found in the actual assembly file names. I therefore replaced “power” with “ppc32 ppc64” and “ppc32, ppc64” in the lists of architectures, which does the trick when CMAKE_SYSTEM_PROCESSOR is set to “ppc32” or “ppc64”. However, I’ve also seen simply “powerpc” being used, and there is also “ppc64le” etc., so I added two additional checks, one for each bitness, so that “powerpc” and values beginning with “ppc64” are detected as ppc64 on 64-bit and “powerpc” and values beginning with “ppc32” are detected as “ppc32” on 32-bit.
When searching for usages, I did find code checking for just “power”, but I deliberately did not catch that with my code, since IBM POWER and PowerPC are separate architectures. I’m not sure if there are real-world use cases where CMAKE_SYSTEM_PROCESSOR is just “power” (our toolchain sets it to “powerpc”, but “ppc32” would probably be more correct)