From a7c7f34fb2f0c31f16957f8b2771d5d79f30ca24 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Fri, 1 Aug 2025 19:35:41 +0200 Subject: [PATCH] [CMAKE] CYGWIN: use GCC instead of AS for building ASM Compiling on CYGWIN shows this error when building assembly sources: /usr/bin/as: unrecognized option `-x' ninja: build stopped: subcommand failed. CMakeLists.txt applies "-x assembler-with-cpp" but this option is expected to work only gcc or g++ drivers are called. Instead, during configuration, CMake prints this: -- Found assembler: /usr/bin/as But this is wrong, because -x option is not recognized by gas. This happens because CMakeLists.txt forces ASM-ATT which excludes gcc and it uses as instead. But it does it ONLY for CYGWIN and actually it is not possible to understand why it has been done. The solution of the problem is to let CMake using GCC instead of AS, by simply removing ASM-ATT and use ASM instead. After that, CMake prints this during the configuration: -- Found assembler: /usr/bin/cc and context is now built without problems after this patch. --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4662802..9c3477f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,11 +140,7 @@ message(STATUS "Boost.Context: " set(ASM_LANGUAGE) if(BOOST_CONTEXT_IMPLEMENTATION STREQUAL "fcontext") if(BOOST_CONTEXT_ASSEMBLER STREQUAL gas OR BOOST_CONTEXT_ASSEMBLER STREQUAL armclang) - if(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin") - set(ASM_LANGUAGE ASM-ATT) - else() - set(ASM_LANGUAGE ASM) - endif() + set(ASM_LANGUAGE ASM) elseif(BOOST_CONTEXT_ASSEMBLER STREQUAL armasm) if(MSVC) set(ASM_LANGUAGE ASM_MARMASM)