1bedd3bd7f
Moves functions out of the main CMakeLists file into module files that can just be included whenever necessary. This also uses the CMake provided variables for enforcing compiler requirements.
15 lines
761 B
CMake
15 lines
761 B
CMake
# This function should be passed a list of all files in a target. It will automatically generate
|
|
# file groups following the directory hierarchy, so that the layout of the files in IDEs matches the
|
|
# one in the filesystem.
|
|
function(create_directory_groups)
|
|
# Place any files that aren't in the source list in a separate group so that they don't get in
|
|
# the way.
|
|
source_group("Other Files" REGULAR_EXPRESSION ".")
|
|
|
|
foreach(file_name ${ARGV})
|
|
get_filename_component(dir_name "${file_name}" PATH)
|
|
# Group names use '\' as a separator even though the entire rest of CMake uses '/'...
|
|
string(REPLACE "/" "\\" group_name "${dir_name}")
|
|
source_group("${group_name}" FILES "${file_name}")
|
|
endforeach()
|
|
endfunction()
|