MACRO(auto_add_subdir cur_dir)
#ignore idea project configure dir
file(GLOB children RELATIVE ${cur_dir} [^.]*)
#set(dirlist "")
foreach(child ${children})
#sure it is dir and has cmakelist.txt file
if(IS_DIRECTORY ${cur_dir}/${child} AND EXISTS ${cur_dir}/${child}/CMakeLists.txt)
#list(APPEND dirlist ${child})
add_subdirectory(${child})
endif()
endforeach()
endmacro()
#example
auto_add_subdir(${CMAKE_CURRENT_SOURCE_DIR})