cmake add_subdirectory匹配多个目录

# 将当前所有目录放入V_GLOB
file(GLOB V_GLOB LIST_DIRECTORIES true "*") 

# 遍历目录
foreach (item ${V_GLOB})
    if (IS_DIRECTORY ${item})
        # 如果是目录
        add_subdirectory(${item})
    endif ()
endforeach ()

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注