How to compile opencv 245 with visual studio 2010 and openCL support?-Collection of common programming errors

I have much trouble compiling OpenCV 245 with GPU support. With some effort I managed to have cuda support up and running, but now I am stuck on opencl, here is the problem:

At some point during the compilation, the file kernels.cpp is generated, containing all kernel functions as strings. For what I understand, they are converted automatically from the .cl files with the cl2cpp.cmake script.

What I don’t understand is that one file is excluded from the build: nonfree_surf.cl (which is on my disk, alongside all other .cl files) is not included, either in the visual studio project, or in the kernels.cpp that is automatically generated. This leads to an undefined error at link time.

I have tried manually adding the nonfree_surf.cl to the visual studio project. This does not change anything. In the CMakeLists.txt for ocl module, all the cl files seem to be automatically added with the line:

file(GLOB CL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/*.cl") 

I have tried manually adding nonfree_surf to CL_FILES, with no effect.

I have very little knowledge of CMake, hence I don’t understand well what is going on. Can somebody give me a clue how I could find the reason of this behavior, namely:

Why are all .cl files added to my VS project, except nonfree_surf.cl ?

How can I correct this ?

Maybe I can execute cl2cpp.cmake script manually ? If so, how ?