diff --git a/CMake/MethaneBuildOptions.cmake b/CMake/MethaneBuildOptions.cmake index 23932e30a..9e75610c8 100644 --- a/CMake/MethaneBuildOptions.cmake +++ b/CMake/MethaneBuildOptions.cmake @@ -156,8 +156,6 @@ else() # Clang or GCC on Linux/MacOS target_link_options(MethaneBuildOptions INTERFACE # -flto - use the link-time optimizer $<$:-flto> - # Disable useless warnings - LINKER:--no_warn_duplicate_libraries ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC @@ -181,6 +179,22 @@ else() # Clang or GCC on Linux/MacOS elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + EXECUTE_PROCESS(COMMAND clang --version OUTPUT_VARIABLE CLANG_FULL_VERSION_STRING) + string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${CLANG_FULL_VERSION_STRING}) + + # Warn about requirement to set OSX architectures for fat-binary starting with XCode & Clang v12.0 + # Build architectures have to be set with cmake generator command line option -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" + if (NOT CMAKE_OSX_ARCHITECTURES AND CLANG_VERSION_STRING VERSION_GREATER_EQUAL 12.0) + message(WARNING "Apple Clang v12.0 requires build architectures to be set explicitly with cmake generator option -DCMAKE_OSX_ARCHITECTURES=\"arm64;x86_64\"") + endif() + + # Disable duplicate libraries warning for AppleClang >= 15.0 + if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 15.0) + target_link_options(MethaneBuildOptions INTERFACE + LINKER:-no_warn_duplicate_libraries + ) + endif() + if(METHANE_RHI_PIMPL_INLINE_ENABLED AND METHANE_GFX_API EQUAL METHANE_GFX_METAL) target_compile_options(MethaneBuildOptions INTERFACE # Compile all C++ sources as Objective-C++ in case of RHI PIMPL inlining diff --git a/CMake/MethaneGlobalOptions.cmake b/CMake/MethaneGlobalOptions.cmake index 6cb0bce92..d63057870 100644 --- a/CMake/MethaneGlobalOptions.cmake +++ b/CMake/MethaneGlobalOptions.cmake @@ -44,16 +44,6 @@ if(WIN32) elseif(APPLE) - if (NOT CMAKE_OSX_ARCHITECTURES) - # Warn about requirement to set OSX architectures for fat-binary starting with XCode & Clang v12.0 - # Build architectures have to be set with cmake generator command line option -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" - EXECUTE_PROCESS(COMMAND clang --version OUTPUT_VARIABLE CLANG_FULL_VERSION_STRING) - string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${CLANG_FULL_VERSION_STRING}) - if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 12.0) - message(WARNING "Apple Clang v12.0 requires build architectures to be set explicitly with cmake generator option -DCMAKE_OSX_ARCHITECTURES=\"arm64;x86_64\"") - endif() - endif() - # Set OS deployment target minimum version if (DEPLOYMENT_TARGET) set(CMAKE_OSX_DEPLOYMENT_TARGET "${DEPLOYMENT_TARGET}")