|
@@ -1,6 +1,21 @@
|
|
|
add_library(SDL3-collector INTERFACE)
|
|
|
add_library(SDL3_test-collector INTERFACE)
|
|
|
|
|
|
+function(sdl_source_group prefix_directory)
|
|
|
+ set(prefixed_list)
|
|
|
+ file(TO_CMAKE_PATH ${prefix_directory} normalized_prefix_path)
|
|
|
+ foreach(file in ${ARGN})
|
|
|
+ file(TO_CMAKE_PATH ${file} normalized_path)
|
|
|
+ string(FIND "${normalized_path}" ${normalized_prefix_path} position)
|
|
|
+ if("${position}" EQUAL 0)
|
|
|
+ list(APPEND prefixed_list ${file})
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ if(prefixed_list)
|
|
|
+ source_group(TREE ${prefix_directory} FILES ${prefixed_list})
|
|
|
+ endif()
|
|
|
+endfunction()
|
|
|
+
|
|
|
# Use sdl_glob_sources to add glob sources to SDL3-shared, to SDL3-static, or to both.
|
|
|
function(sdl_glob_sources)
|
|
|
cmake_parse_arguments(ARGS "" "" "SHARED;STATIC" ${ARGN})
|
|
@@ -13,6 +28,7 @@ function(sdl_glob_sources)
|
|
|
if(TARGET SDL3-static)
|
|
|
target_sources(SDL3-static PRIVATE ${static_sources} ${both_sources})
|
|
|
endif()
|
|
|
+ sdl_source_group(${PROJECT_SOURCE_DIR} ${shared_sources} ${shared_sources} ${both_sources})
|
|
|
set_property(TARGET SDL3-collector APPEND PROPERTY INTERFACE_SOURCES ${shared_sources} ${static_sources} ${both_sources})
|
|
|
endfunction()
|
|
|
|
|
@@ -25,6 +41,7 @@ function(sdl_sources)
|
|
|
if(TARGET SDL3-static)
|
|
|
target_sources(SDL3-static PRIVATE ${ARGS_STATIC} ${ARGS_UNPARSED_ARGUMENTS})
|
|
|
endif()
|
|
|
+ sdl_source_group(${PROJECT_SOURCE_DIR} ${ARGS_SHARED} ${ARGS_STATIC} ${ARGS_UNPARSED_ARGUMENTS})
|
|
|
set_property(TARGET SDL3-collector APPEND PROPERTY INTERFACE_SOURCES ${ARGS_SHARED} ${ARGS_STATIC} ${ARGS_UNPARSED_ARGUMENTS})
|
|
|
endfunction()
|
|
|
|