aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-03-26 04:46:43 +0100
committercrueter <crueter@eden-emu.dev>2026-03-26 04:46:43 +0100
commit9cb700165634a271437abed723a53888eeb6be9c (patch)
treeb398a3765217901c0969147b69fa36d462a9aaff /src/CMakeLists.txt
parentf0d77e86e34cde3813f7b1dbfc4d1a9e8940b21b (diff)
[cmake] fixes for XCode when having languages other than C/C++ (#3772)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3772 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9fa5314b7..600b985609 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,47 +118,42 @@ if (MSVC AND NOT CXX_CLANG)
else()
if (NOT MSVC)
add_compile_options(
- -fwrapv
- -fno-rtti # Disable RTTI
- -pipe
- )
+ $<$<COMPILE_LANGUAGE:C,CXX>:-fwrapv>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-pipe>
+ # Disable RTTI (C++ only)
+ $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
endif()
add_compile_options(
- -Werror=all
- -Werror=extra
- -Werror=missing-declarations
- -Werror=shadow
- -Werror=unused
-
- -Wno-attributes
- -Wno-invalid-offsetof
- -Wno-unused-parameter
- -Wno-missing-field-initializers
- )
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=all>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=extra>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=missing-declarations>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=shadow>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unused>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-attributes>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-invalid-offsetof>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-parameter>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-missing-field-initializers>)
if (CXX_CLANG OR CXX_ICC OR CXX_APPLE) # Clang, AppleClang, or Intel C++
if (NOT MSVC)
add_compile_options(
- -Werror=shadow-uncaptured-local
- -Werror=implicit-fallthrough
- -Werror=type-limits
- )
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=shadow-uncaptured-local>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=implicit-fallthrough>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Werror=type-limits>)
endif()
-
add_compile_options(
- -Wno-braced-scalar-init
- -Wno-unused-private-field
- -Wno-nullability-completeness
- )
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-braced-scalar-init>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-private-field>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-nullability-completeness>)
endif()
if (ARCHITECTURE_x86_64)
- add_compile_options("-mcx16")
+ add_compile_options(-mcx16)
endif()
if (APPLE AND CXX_CLANG)
- add_compile_options("-stdlib=libc++")
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-stdlib=libc++>)
endif()
# GCC bugs
@@ -166,10 +161,9 @@ else()
# These diagnostics would be great if they worked, but are just completely broken
# and produce bogus errors on external libraries like fmt.
add_compile_options(
- -Wno-array-bounds
- -Wno-stringop-overread
- -Wno-stringop-overflow
- )
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-array-bounds>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-stringop-overread>
+ $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-stringop-overflow>)
endif()
# Set file offset size to 64 bits.