~aleteoryx/muditaos

ref: a405cad694b867fcd2498984830bd97d4b9bde2f muditaos/cmake/modules/AddDirectories.cmake -rw-r--r-- 736 bytes
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#[[
Example of use:
add_directories(
        TARGET <target name>
        PREFIX <paths prefix>
        DEPENDS <dependencies list>
        DIRECTORIES <dir1 dir2 dir3 dir_n>
)
]]#
function(add_directories)
    cmake_parse_arguments(
            _ASSETS
            ""
            "TARGET;PREFIX"
            "DEPENDS;DIRECTORIES"
            ${ARGN}
    )
    set(command)
    foreach (entry ${_ASSETS_DIRECTORIES})
        list(APPEND command
                COMMAND mkdir -p ${_ASSETS_PREFIX}/${entry})
    endforeach ()

    add_custom_target(
            ${_ASSETS_TARGET}
            DEPENDS ${_ASSETS_DEPENDS}
            ${command}
            COMMENT
            "Adding directories: ${_ASSETS_DIRECTORIES}"
    )
endfunction()