From 1e8443f54e4ec729ce4a003e1636219702fb1de5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 12 Jan 2023 21:12:54 +0100 Subject: [PATCH] cmake: only use $ when CMAKE_OBJC_COMPILER is defined --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e0bf0e05e..48d08cbf9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -560,14 +560,20 @@ if(USE_GCC OR USE_CLANG) if(CMAKE_VERSION VERSION_LESS 3.3) target_compile_options(sdl-global-options INTERFACE "-Werror=declaration-after-statement") else() - target_compile_options(sdl-global-options INTERFACE "$<$,$>:-Werror=declaration-after-statement>") + target_compile_options(sdl-global-options INTERFACE "$<$:-Werror=declaration-after-statement>") + if(CMAKE_OBJC_COMPILER) + target_compile_options(sdl-global-options INTERFACE "$<$:-Werror=declaration-after-statement>") + endif() endif() endif() endif() if(CMAKE_VERSION VERSION_LESS 3.3) target_compile_options(sdl-global-options INTERFACE "-Wdeclaration-after-statement") else() - target_compile_options(sdl-global-options INTERFACE "$<$,$>:-Wdeclaration-after-statement>") + target_compile_options(sdl-global-options INTERFACE "$<$:-Wdeclaration-after-statement>") + if(CMAKE_OBJC_COMPILER) + target_compile_options(sdl-global-options INTERFACE "$<$:-Wdeclaration-after-statement>") + endif() endif() endif()