File: FindSubnetTree.cmake

package info (click to toggle)
capstats 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 488 kB
  • sloc: cpp: 498; sh: 165; makefile: 38
file content (26 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (23)
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
# - Determine if the SubnetTree Python module is available
#
# Usage of this module as follows:
#
#  find_package(PythonInterp REQUIRED)
#  find_package(SubnetTree)
#
# Variables defined by this module:
#
#  SUBNETTREE_FOUND             Python successfully imports SubnetTree module

if (NOT SUBNETTREE_FOUND)
    execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import SubnetTree"
                    RESULT_VARIABLE SUBNETTREE_IMPORT_RESULT)

    if (SUBNETTREE_IMPORT_RESULT)
        # python returned non-zero exit status
        set(SUBNETTREE_PYTHON_MODULE false)
    else ()
        set(SUBNETTREE_PYTHON_MODULE true)
    endif ()
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SubnetTree DEFAULT_MSG
                                  SUBNETTREE_PYTHON_MODULE)