folderize.cmake 571 B

1234567891011121314151617
  1. # Mirror the folder structure for sources inside the IDE...
  2. function(folderize_sources sources prefix)
  3. foreach(FILE ${${sources}})
  4. get_filename_component(PARENT_DIR "${FILE}" PATH)
  5. # skip src or include and changes /'s to \\'s
  6. string(REPLACE "${prefix}" "" GROUP "${PARENT_DIR}")
  7. string(REPLACE "/" "\\" GROUP "${GROUP}")
  8. # If it's got a path, then append a "\\" separator (otherwise leave it blank)
  9. if ("${GROUP}" MATCHES ".+")
  10. set(GROUP "\\${GROUP}")
  11. endif()
  12. source_group("${GROUP}" FILES "${FILE}")
  13. endforeach()
  14. endfunction(folderize_sources)