File: source_tree.cmake

package info (click to toggle)
intel-compute-runtime 22.43.24595.41-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,740 kB
  • sloc: cpp: 631,142; lisp: 3,515; sh: 470; makefile: 76; python: 21
file content (37 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download | duplicates (3)
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
32
33
34
35
36
37
#
# Copyright (C) 2020-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

function(create_source_tree target directory)
  if(WIN32)
    get_filename_component(directory ${directory} ABSOLUTE)
    get_target_property(source_list ${target} SOURCES)
    #source_group fails with file generated in build directory
    if(DEFINED L0_DLL_RC_FILE)
      list(FIND source_list ${L0_DLL_RC_FILE} _index)
      if(${_index} GREATER -1)
        list(REMOVE_ITEM source_list ${L0_DLL_RC_FILE})
      endif()
    endif()
    source_group(TREE ${directory} FILES ${source_list})
  endif()
endfunction()

macro(add_subdirectoriesL0 curdir dirmask)
  file(GLOB children RELATIVE ${curdir} ${curdir}/${dirmask})
  set(dirlist "")

  foreach(child ${children})
    if(IS_DIRECTORY ${curdir}/${child})
      list(APPEND dirlist ${child})
    endif()
  endforeach()

  foreach(subdir ${dirlist})
    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt)
      add_subdirectory(${subdir})
    endif()
  endforeach()
endmacro()