From: Gregor Jasny Date: Fri, 2 Jun 2023 10:34:56 +0000 (+0200) Subject: Fix Intel Xcode builds with assembly X-Git-Tag: v1.5.6^2~142^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e09f07b325b6e2a95e11776f23ff97716b7b924;p=thirdparty%2Fzstd.git Fix Intel Xcode builds with assembly When forcing the source file language to `C`, Xcode enforces the file to be compiled as `C` by appending `-x c` to the compiler command line. For now try to limit the damage and only enforce the language if the ASM and C compilers differ. Reproducer (CMake `3.26.4`, Xcode `14.3`): ``` cmake -S build/cmake -B _b -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake --build _b ``` Fix: #3622 --- diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index 457b54797..3cab017a7 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -105,7 +105,9 @@ endif () # Our assembly expects to be compiled by a C compiler, and is only enabled for # __GNUC__ compatible compilers. Otherwise all the ASM code is disabled by # macros. -set_source_files_properties(${Sources} PROPERTIES LANGUAGE C) +if(NOT CMAKE_ASM_COMPILER STREQUAL CMAKE_C_COMPILER) + set_source_files_properties(${Sources} PROPERTIES LANGUAGE C) +endif() macro (add_definition target var) if (NOT ("${${var}}" STREQUAL ""))