File: CommonCMakeUtils.cmake

package info (click to toggle)
nextpnr 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,908 kB
  • sloc: cpp: 219,642; python: 21,427; ansic: 10,274; sh: 779; makefile: 493; tcl: 116; vhdl: 44; objc: 42
file content (27 lines) | stat: -rw-r--r-- 1,142 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
# extract filename components of all items in src_list in dst_list
# example usage: extract_filename_components(ALL_LIBS_BASENAME ALL_LIBS NAME_WE)
macro(extract_filename_components dst_list src_list component)  
  set(list_var "${${src_list}}")
  #message(STATUS "list_var:     ${list_var}")
  #message(STATUS "component:    ${component}")
  foreach(item ${list_var})
    get_filename_component(BASENAME ${item} ${component})
  list( APPEND ${dst_list} ${BASENAME})
  endforeach()
  #message(STATUS "dst_list:     ${${dst_list}}")
endmacro()


# extract target properties of all items in src_list in dst_list
# example usage: extract_target_properties(QT_INCLUDES Qt5::Core INTERFACE_INCLUDE_DIR)
macro(extract_target_properties target_props target_list property)  
  set(list_var "${${target_list}}")
  # message(STATUS "list_var:     ${list_var}")
  #message(STATUS "property:    ${property}")
  foreach(item ${list_var})
    get_target_property(value ${item} ${property})
  list( APPEND ${target_props} ${value})
  endforeach()
  #message(STATUS "target_props:     ${${target_props}}")
  list(REMOVE_DUPLICATES ${target_props})
endmacro()