diff --git a/bindings/r/CMakeLists.txt b/bindings/r/CMakeLists.txt
index 146115ba7f9553f0d19d2fd6348f038ff28b90a6..9b1a335bcaa24f4603eb38f1df2b187946c3faa5 100644
--- a/bindings/r/CMakeLists.txt
+++ b/bindings/r/CMakeLists.txt
@@ -30,8 +30,11 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RInterface
     Thread
 )
 
-ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-cast-function-type)
-ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-overloaded-virtual)
+ROOT_ADD_CXX_FLAG(_R_FLAGS -Wno-cast-function-type)
+ROOT_ADD_CXX_FLAG(_R_FLAGS -Wno-overloaded-virtual)
 
+separate_arguments(_R_FLAGS)
+
+target_compile_options(RInterface PUBLIC ${_R_FLAGS})
 target_include_directories(RInterface BEFORE PUBLIC ${R_INCLUDE_DIRS})
 target_link_libraries(RInterface PUBLIC ${R_LIBRARIES} readline)