File: Config.cmake.in

package info (click to toggle)
libbgcode 0.0~git20250220.5041c09-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,188 kB
  • sloc: cpp: 3,700; python: 255; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 1,450 bytes parent folder | download
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
49
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

set(_@PROJECT_NAME@_supported_components @_selected_components@)

set(Core_deps "@Core_DOWNSTREAM_DEPS@")
set(Binarize_deps "@Binarize_DOWNSTREAM_DEPS@")
set(Convert_deps "@Convert_DOWNSTREAM_DEPS@")
set(Boost_comps "@Boost_DOWNSTREAM_COMPONENTS@")

set(_comps ${@PROJECT_NAME@_FIND_COMPONENTS})
if (_comps)
  if ("Convert" IN_LIST _comps)
    list(PREPEND _comps Binarize)
  endif ()
  list(PREPEND _comps Core)
  list(REMOVE_DUPLICATES _comps)
else() # empty list of components, include all
  set(_comps ${_@PROJECT_NAME@_supported_components})
endif ()

foreach(_comp ${_comps})
  if (NOT _comp IN_LIST _@PROJECT_NAME@_supported_components)
    set(@PROJECT_NAME@_FOUND False)
    set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
  endif()
  include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@${_comp}Targets.cmake")

  foreach (_pkg_ver ${${_comp}_deps})
    # Use regular expression to extract package name and version
    string(REGEX MATCH "^(.*)_([0-9]+\\.[0-9]+\\.?[0-9]*)$" extracted_parts ${_pkg_ver})

    # Access the extracted groups
    set(package_name ${CMAKE_MATCH_1})
    set(package_version ${CMAKE_MATCH_2})
    set(comps ${${package_name}_comps})

    if (comps)
      find_dependency(${package_name} ${package_version} COMPONENTS ${comps})
    else ()
      find_dependency(${package_name} ${package_version})
    endif ()
  endforeach()

endforeach()