1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

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
This commit is contained in:
Gregor Jasny
2023-06-02 12:34:56 +02:00
parent 5059618295
commit 7e09f07b32

View File

@ -105,7 +105,9 @@ endif ()
# Our assembly expects to be compiled by a C compiler, and is only enabled for # 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 # __GNUC__ compatible compilers. Otherwise all the ASM code is disabled by
# macros. # 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) macro (add_definition target var)
if (NOT ("${${var}}" STREQUAL "")) if (NOT ("${${var}}" STREQUAL ""))