summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d814bb74f..aa2154cb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,12 +323,14 @@ endif()
323# This function should be passed a list of all files in a target. It will automatically generate 323# This function should be passed a list of all files in a target. It will automatically generate
324# file groups following the directory hierarchy, so that the layout of the files in IDEs matches the 324# file groups following the directory hierarchy, so that the layout of the files in IDEs matches the
325# one in the filesystem. 325# one in the filesystem.
326function(create_directory_groups) 326function(create_target_directory_groups target_name)
327 # Place any files that aren't in the source list in a separate group so that they don't get in 327 # Place any files that aren't in the source list in a separate group so that they don't get in
328 # the way. 328 # the way.
329 source_group("Other Files" REGULAR_EXPRESSION ".") 329 source_group("Other Files" REGULAR_EXPRESSION ".")
330 330
331 foreach(file_name ${ARGV}) 331 get_target_property(target_sources "${target_name}" SOURCES)
332
333 foreach(file_name IN LISTS target_sources)
332 get_filename_component(dir_name "${file_name}" PATH) 334 get_filename_component(dir_name "${file_name}" PATH)
333 # Group names use '\' as a separator even though the entire rest of CMake uses '/'... 335 # Group names use '\' as a separator even though the entire rest of CMake uses '/'...
334 string(REPLACE "/" "\\" group_name "${dir_name}") 336 string(REPLACE "/" "\\" group_name "${dir_name}")