菜鸟笔记
提升您的技术认知

cmake迭代遍历文件夹,建立过滤器-ag真人游戏

vs下cmake遍历文件夹并建立过滤器

function(retrieve_files out_files)
    set(source_list)
    foreach(dirname ${
  argn})
        file(glob_recurse files relative ${
  cmake_current_source_dir}
			"${dirname}/*.cmake"
            "${dirname}/*.h"
            "${dirname}/*.hpp"
            "${dirname}/*.c"
            "${dirname}/*.cpp"
            "${dirname}/*.cc"            
        )
        foreach(filename ${
  files})
            list(append source_list "${cmake_current_source_dir}/${filename}")
			set(file_abs_path "${cmake_current_source_dir}/${filename}")
			get_filename_component(source_path "${filename}" path)
            string(replace "/" "\\" filter_dir "${source_path}")
            source_group("${filter_dir}" files "${filename}")
        endforeach()
    endforeach()
    set(${
  out_files} ${
  source_list} parent_scope)
endfunction()
网站地图