msdfgen/cmake/folderize.cmake

18 lines
571 B
CMake

# Mirror the folder structure for sources inside the IDE...
function(folderize_sources sources prefix)
foreach(FILE ${${sources}})
get_filename_component(PARENT_DIR "${FILE}" PATH)
# skip src or include and changes /'s to \\'s
string(REPLACE "${prefix}" "" GROUP "${PARENT_DIR}")
string(REPLACE "/" "\\" GROUP "${GROUP}")
# If it's got a path, then append a "\\" separator (otherwise leave it blank)
if ("${GROUP}" MATCHES ".+")
set(GROUP "\\${GROUP}")
endif()
source_group("${GROUP}" FILES "${FILE}")
endforeach()
endfunction(folderize_sources)