folders.cmake (837B)
1 set_property(GLOBAL PROPERTY USE_FOLDERS YES) 2 3 # Call this function at the end of a directory scope to assign a folder to 4 # targets created in that directory. Utility targets will be assigned to the 5 # UtilityTargets folder, otherwise to the ${name}Targets folder. If a target 6 # already has a folder assigned, then that target will be skipped. 7 function(add_folders name) 8 get_property(targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS) 9 foreach(target IN LISTS targets) 10 get_property(folder TARGET "${target}" PROPERTY FOLDER) 11 if(DEFINED folder) 12 continue() 13 endif() 14 set(folder Utility) 15 get_property(type TARGET "${target}" PROPERTY TYPE) 16 if(NOT type STREQUAL "UTILITY") 17 set(folder "${name}") 18 endif() 19 set_property(TARGET "${target}" PROPERTY FOLDER "${folder}Targets") 20 endforeach() 21 endfunction()