# CMake Error: check_cxx_source_compiles failed with: 'error: #error Architecture not supported'

- **ID:** `cmake/check-cxx-source-compiles-arch-specific`
- **Domain:** cmake
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

CMake's TryCompile check uses a source snippet that contains an architecture guard (#ifdef __arm__ etc.) which fails on the current target CPU, causing the feature detection to return false and abort.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CMake 3.27 | active | — | — |
| CMake 3.28 | active | — | — |
| GCC 12 | active | — | — |
| Clang 16 | active | — | — |

## Workarounds

1. **Override the test by setting the variable that check_cxx_source_compiles would define, e.g. set(HAVE_ARCH_SUPPORT 1) in CMakeCache.txt or via -DHAVE_ARCH_SUPPORT=ON on command line.** (70% success)
   ```
   Override the test by setting the variable that check_cxx_source_compiles would define, e.g. set(HAVE_ARCH_SUPPORT 1) in CMakeCache.txt or via -DHAVE_ARCH_SUPPORT=ON on command line.
   ```
2. **Patch the CMake module file (e.g., /usr/share/cmake-3.28/Modules/FindSomething.cmake) to remove the architecture check or add your arch to the #ifndef list.** (85% success)
   ```
   Patch the CMake module file (e.g., /usr/share/cmake-3.28/Modules/FindSomething.cmake) to remove the architecture check or add your arch to the #ifndef list.
   ```

## Dead Ends

- **Set CMAKE_CXX_FLAGS to -march=native or -march=armv8-a** — The error is in the test source itself, not in the flags. Changing march doesn't remove the #error directive. (60% fail)
- **Delete CMakeCache.txt and reconfigure** — The cache is not the problem; the test source is hardcoded in the Find module or CMake module. (50% fail)
