based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

folders.cmake (837B)


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