33 lines
916 B
CMake
33 lines
916 B
CMake
|
|
function(put_targets_into_folder)
|
|
set(oneValueArgs FOLDER)
|
|
set(multiValueArgs TARGETS)
|
|
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
foreach(target ${ARGS_TARGETS})
|
|
# Check if target exists
|
|
if (NOT TARGET ${target})
|
|
message(FATAL_ERROR "${target} target not found")
|
|
endif()
|
|
|
|
# Get the actual target (if it is aliased)
|
|
get_target_property(actual_target ${target} ALIASED_TARGET)
|
|
if (NOT actual_target)
|
|
set(actual_target ${target})
|
|
endif()
|
|
|
|
# Set the folder property for the target
|
|
set_target_properties(${actual_target} PROPERTIES FOLDER ${ARGS_FOLDER})
|
|
endforeach()
|
|
endfunction()
|
|
|
|
|
|
function(find_files var_name path)
|
|
set(sources)
|
|
foreach(ext ${ARGN})
|
|
file(GLOB_RECURSE files "${path}/*.${ext}")
|
|
list(APPEND sources ${files})
|
|
endforeach()
|
|
set(${var_name} ${${var_name}} ${sources} PARENT_SCOPE)
|
|
endfunction()
|
|
|