File: simdjson-props.cmake

package info (click to toggle)
simdjson 4.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,936 kB
  • sloc: cpp: 171,612; ansic: 19,122; sh: 1,126; python: 842; makefile: 47; ruby: 25; javascript: 13
file content (48 lines) | stat: -rw-r--r-- 1,229 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
38
39
40
41
42
43
44
45
46
47
48
#
# Accumulate flags
#
set(simdjson_props_script "${PROJECT_BINARY_DIR}/simdjson-props.cmake")
set(simdjson_props_content "")
set(simdjson_props_flushed NO)

function(simdjson_add_props command)
  set(args "")
  math(EXPR limit "${ARGC} - 1")
  foreach(i RANGE 1 "${limit}")
    set(value "${ARGV${i}}")
    if(value MATCHES "^(PRIVATE|PUBLIC)$")
      string(TOLOWER "${value}" value)
      set(value "\${${value}}")
    else()
      set(value "[==[${value}]==]")
    endif()
    string(APPEND args " ${value}")
  endforeach()

  set(simdjson_props_flushed NO PARENT_SCOPE)
  set(
      simdjson_props_content
      "${simdjson_props_content}${command}(\"\${target}\"${args})\n"
      PARENT_SCOPE
  )
endfunction()

macro(simdjson_flush_props)
  if(NOT simdjson_props_flushed)
    set(simdjson_props_flushed YES PARENT_SCOPE)
    file(WRITE "${simdjson_props_script}" "${simdjson_props_content}")
  endif()
endmacro()

function(simdjson_apply_props target)
  set(private PRIVATE)
  set(public PUBLIC)
  get_target_property(TYPE "${target}" TYPE)
  if(TYPE STREQUAL "INTERFACE_LIBRARY")
    set(private INTERFACE)
    set(public INTERFACE)
  endif()

  simdjson_flush_props()
  include("${simdjson_props_script}")
endfunction()