Reputation: 4500
Is there a simple, reliable way to detect in a CMake file that the system CMake is building for is based on the x86 instruction set (regardless of bitness)?
Upvotes: 1
Views: 9710
Reputation: 4500
Here is my solution so far:
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
set (X86 TRUE)
else ()
set (X86 FALSE)
endif ()
Please complete the regular expression if you know of or find x86 systems for which CMAKE_SYSTEM_PROCESSOR
does not contain "x86", "X86", "amd64" or "AMD64" substrings.
Upvotes: 6