From 3b8b01ede85e1c20912fbc68e1f5ea2258456b08 Mon Sep 17 00:00:00 2001 From: Dario Izzo Date: Mon, 23 Sep 2024 16:50:01 +0200 Subject: [PATCH] cmake workaround for the /bin/sh: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: command not found issue --- CMakeLists.txt | 7 ++++++- cmake/yacma/YACMACompilerLinkerSettings.cmake | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 086b8eec..8f769f6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ # NOTE: current minimum kep3 requirement. -cmake_minimum_required(VERSION 3.18.0) +cmake_minimum_required(VERSION 3.28.0) # This effectively requests behavior preferred as of a given CMake version and tells newer CMake versions to warn about their new policies. cmake_policy(VERSION 3.30) +# This removes a strange behaviour on osx CI machines where ninja would error out with +# '/bin/sh: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: command not found' even if clang-scan-deps was installed +# Since we here do not use modules we deactivate their search. +set(CMAKE_CXX_SCAN_FOR_MODULES 0) + # Set default build type to "Release". # NOTE: this should be done before the project command since the latter can set # CMAKE_BUILD_TYPE itself (it does so for nmake). diff --git a/cmake/yacma/YACMACompilerLinkerSettings.cmake b/cmake/yacma/YACMACompilerLinkerSettings.cmake index edafe6d4..3d9cd9da 100644 --- a/cmake/yacma/YACMACompilerLinkerSettings.cmake +++ b/cmake/yacma/YACMACompilerLinkerSettings.cmake @@ -82,6 +82,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) # Configuration bits specific for GCC. if(YACMA_COMPILER_IS_GNUCXX) _YACMA_CHECK_ENABLE_CXX_FLAG(-fdiagnostics-color=auto) + _YACMA_CHECK_ENABLE_CXX_FLAG(-Woverloaded-virtual) # New in GCC 9. _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Waddress-of-packed-member) endif() @@ -109,7 +110,6 @@ if(NOT _YACMACompilerLinkerSettingsRun) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wc99-designator) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wreorder-init-list) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wsizeof-pointer-div) - _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wsizeof-array-div) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wxor-used-as-pow) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wfinal-dtor-non-final-class) # New warnings in clang 11. @@ -122,13 +122,19 @@ if(NOT _YACMACompilerLinkerSettingsRun) # NOTE: this is a new flag in Clang 13 which seems to give # incorrect warnings for UDLs. _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wno-reserved-identifier) + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Warray-bounds-pointer-arithmetic) + # New warnings in clang 14. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Warray-parameter) endif() # Common configuration for GCC, clang and Intel. if(YACMA_COMPILER_IS_CLANGXX OR YACMA_COMPILER_IS_INTELXX OR YACMA_COMPILER_IS_GNUCXX) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wall) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wextra) - _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnon-virtual-dtor) + # NOTE: this flag has been superseded by "-Wdelete-non-virtual-dtor" + # (enabled by "-Wall"). See: + # https://gcc.gnu.org/pipermail/gcc-cvs/2022-November/374730.html + # _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnon-virtual-dtor) # NOTE: this flag is a bit too chatty, let's disable it for the moment. #_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wnoexcept) _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wlogical-op)