Skip to content
Snippets Groups Projects
Commit 96c9cef6 authored by demiralp's avatar demiralp
Browse files

Added cmake utility for assigning source groups to a glob.

parent 7c4a6138
No related branches found
No related tags found
1 merge request!120Feature/#401 proper folder structure
# Assigns the given files to source groups identical to their location.
function(assign_source_group)
foreach(_SOURCE IN ITEMS ${ARGN})
if (IS_ABSOLUTE "${_SOURCE}")
file(RELATIVE_PATH _SOURCE_REL "${CMAKE_CURRENT_SOURCE_DIR}" "${_SOURCE}")
else()
set(_SOURCE_REL "${_SOURCE}")
endif()
get_filename_component(_SOURCE_PATH "${_SOURCE_REL}" PATH)
if(WIN32)
string(REPLACE "/" "\\" _SOURCE_PATH_MSVC "${_SOURCE_PATH}")
source_group("${_SOURCE_PATH_MSVC}" FILES "${_SOURCE}")
else()
source_group("${_SOURCE_PATH}" FILES "${_SOURCE}")
endif()
endforeach()
endfunction(assign_source_group)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment