From 74ba67f0728e6bde02214f5d91ca560073eb7c04 Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Fri, 3 Apr 2026 14:32:21 +0000 Subject: [PATCH] refactor: update compiler flag handling in CMake and ignore build log files --- .gitignore | 2 ++ CMakeLists.txt | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 678fb99..228451b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ test_props.xml test_props2.xml test_boost.cpp .claude/settings.json +build_output.log +configure_output.log diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e12148..5eb6067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,14 +19,14 @@ endif() project(uLib) -# Remove GCC-only flag injected by conda's CFLAGS/CXXFLAGS that clang doesn't support. -# Must run after project() since that's when CMake initialises CMAKE__FLAGS from env. +# Applica la flag SOLO se il compilatore è GCC +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-fno-merge-constants) +endif() + +# Disabilita il warning se il compilatore è Clang (o AppleClang) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - foreach(_lang C CXX) - foreach(_var CMAKE_${_lang}_FLAGS CMAKE_${_lang}_FLAGS_RELEASE CMAKE_${_lang}_FLAGS_RELWITHDEBINFO CMAKE_${_lang}_FLAGS_DEBUG) - string(REPLACE "-fno-merge-constants" "" ${_var} "${${_var}}") - endforeach() - endforeach() + add_compile_options(-Wno-ignored-optimization-argument) endif() # CUDA Toolkit seems to be missing locally. Toggle ON if nvcc is made available.