From a4d1a96e7ef1a6e23909853c6e35058bc91d67e9 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sun, 6 Sep 2026 21:21:40 +0200 Subject: [PATCH] [RF] Avoid deprecation warnings when building RooFit tests Follows up on 177d13dc870a0b21, bringing back the good old `ROOFIT_BUILDS_ITSELF` macro for this development cycle to avoid compilation warnings when building RooFit's own unit tests. --- roofit/roofitcore/CMakeLists.txt | 3 +++ roofit/roofitcore/inc/RooGlobalFunc.h | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/roofit/roofitcore/CMakeLists.txt b/roofit/roofitcore/CMakeLists.txt index d8143917c8073..8f64fc9fef966 100644 --- a/roofit/roofitcore/CMakeLists.txt +++ b/roofit/roofitcore/CMakeLists.txt @@ -509,6 +509,9 @@ if(fftw3) target_link_libraries(RooFitCore PRIVATE FFTW::Double) endif() +# Used to silence deprecation warnings when testing deprecated features +target_compile_definitions(RooFitCore PUBLIC ROOFIT_BUILDS_ITSELF) + target_include_directories(RooFitCore PUBLIC $) # The SMatrix package is header-only, but it's only exposed via the Smatrix diff --git a/roofit/roofitcore/inc/RooGlobalFunc.h b/roofit/roofitcore/inc/RooGlobalFunc.h index 180d7308c73c5..eb1f27b7915fc 100644 --- a/roofit/roofitcore/inc/RooGlobalFunc.h +++ b/roofit/roofitcore/inc/RooGlobalFunc.h @@ -267,9 +267,15 @@ class EvalBackend : public RooCmdArg { EvalBackend(std::string const &name); static EvalBackend Legacy() - R__DEPRECATED(6, 44, "The legacy evaluation backend will be removed in ROOT 6.44. " - "Use the default \"cpu\" evaluation backend, i.e. simply don't pass any EvalBackend() " - "command argument."); +// Deprecation macro skipped when building RooFit itself, so we don't get +// warnings when unit testing deprecated features. +#ifndef ROOFIT_BUILDS_ITSELF + R__DEPRECATED(6, 44, + "The legacy evaluation backend will be removed in ROOT 6.44. " + "Use the default \"cpu\" evaluation backend, i.e. simply don't pass any EvalBackend() " + "command argument.") +#endif + ; static EvalBackend Cpu(); static EvalBackend Cuda(); static EvalBackend Codegen();