def METHOD_NAME(cmakedir,cmakebuilddir=None):
    """will compile the cmake project and run testfn
    """
    cmakeoptions = ''
    cmakedir = os.path.abspath(cmakedir)
    cmakename = os.path.split(cmakedir)[1]
    makecommand = 'make '
    if cmakebuilddir is None:
        cmakebuilddir = cmakename+'_build'
    programdir = cmakebuilddir
    if openravepyCompilerVersion().startswith('msvc'):
        cmakeoptions += '-G "Visual Studio 10" '
        makecommand = '"C:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" x86 && msbuild %s.sln /p:Configuration=RelWithDebInfo /maxcpucount:1'%cmakename
    if sys.platform.startswith('win') or platform.system().lower() == 'windows':
        programdir += '\\RelWithDebInfo'
    try:
        # remove dir first since it could contain cached information of previous versions
        shutil.rmtree(cmakebuilddir)
    except:
        pass
    os.mkdir(cmakebuilddir)
    curdir = os.getcwd()
    try:
        os.chdir(cmakebuilddir)
        assert(os.system('cmake %s %s'%(cmakeoptions,cmakedir)) == 0)
        assert(os.system(makecommand) == 0)
        os.chdir(curdir)
        if openravepyCompilerVersion().startswith('msvc'):
            dllfilename = os.path.join(programdir,cmakename+'.dll')
            if os.path.exists(dllfilename):
                shutil.copyfile(dllfilename,os.path.join(cmakebuilddir,cmakename+'.dll'))
        return programdir
    finally:
        os.chdir(curdir)