Exclude files from cpp-library sources

Hi,

I’m using gradle 5.6.4 with the new cpp-library plugin.
I need to exclude some files from build sources but can’t figure how.
This is the project layout:

my_cpp_library
| -- build.gradle
| -- src
|     | -- main
|     |       | -- cpp     
|     |       |     | -- hello.cpp
|     |       |     | -- exclude_me.cpp
|     |       | -- public  
|     |             | -- hello.h

And this is the build.gradle:

plugins {
    // Apply the cpp-library plugin to add support for building CPP libraries
    id 'cpp-library'
}

library {
    source.filter { File f -> 
        println "file is ${f}"
        ! (f.name == "exclude_me.cpp")
    }
}

I still see that exclude_map.cpp is part of the build.

Could you please tell what is wrong?

Thanks