# Tries to locate the correct CS_FCONTEXT_ASSEMBLY files for this platform and
# sets CS_FCONTEXT_FOUND to true if the platform is supported.
#
# To add a platform add a clause locating the correct assembly implementations for the system.

SET(CS_FCONTEXT_FOUND TRUE)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
    # Typical Linux running on x86_64
    SET(CS_FCONTEXT_ASSEMBLY
            asm/fcontext/jump_x86_64_sysv_elf_gas.S
            asm/fcontext/make_x86_64_sysv_elf_gas.S
            asm/fcontext/ontop_x86_64_sysv_elf_gas.S)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
    # Typical Linux running on ARMv7
    SET(CS_FCONTEXT_ASSEMBLY
            asm/fcontext/jump_arm_aapcs_elf_gas.S
            asm/fcontext/make_arm_aapcs_elf_gas.S
            asm/fcontext/ontop_arm_aapcs_elf_gas.S)
else ()
    SET(CS_FCONTEXT_FOUND FALSE)
endif ()

if (CS_FCONTEXT_FOUND)
    MESSAGE("-- CS_FCONTEXT_FOUND: ${CS_FCONTEXT_ASSEMBLY}")
else ()
    MESSAGE("-- CS_FCONTEXT_FOUND: NOT FOUND")
endif ()
