From 3626d1bd298597efc7a36de71d7ce87847733e37 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Tue, 9 Mar 2021 12:49:03 +0100 Subject: BUILD(cmake): Fix unity build issue On Unix there are the X11 headers that define incredibly many macros of which basically none are prefixed in any way. Thus these can easily lead to name clashes in other files if unity builds are active. Thus the files known to make problems, are excluded from unity builds in order to avoid that. --- src/mumble/CMakeLists.txt | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 18f861cfd..2186e0358 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -990,17 +990,27 @@ if(wasapi) endif() endif() -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0" AND APPLE) - # Prevent objective C files from being included in unity builds as that causes issues - set_source_files_properties( - "AppNap.mm" - "GlobalShortcut_macx.mm" - "Log_macx.mm" - "os_macx.mm" - "TextToSpeech_macx.mm" - "Overlay_macx.mm" - "CoreAudio.mm" - PROPERTIES - SKIP_UNITY_BUILD_INCLUSION TRUE - ) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") + if (APPLE) + # Prevent objective C files from being included in unity builds as that causes issues + set_source_files_properties( + "AppNap.mm" + "GlobalShortcut_macx.mm" + "Log_macx.mm" + "os_macx.mm" + "TextToSpeech_macx.mm" + "Overlay_macx.mm" + "CoreAudio.mm" + PROPERTIES + SKIP_UNITY_BUILD_INCLUSION TRUE + ) + elseif(UNIX) + # Exclude source files that include the X11 headers as these define + # an awful lot of macros that can conflict with other code + set_source_files_properties( + "GlobalShortcut_unix.cpp" + PROPERTIES + SKIP_UNITY_BUILD_INCLUSION TRUE + ) + endif() endif() -- cgit v1.2.3