File: RequiredArtifactsCheck.cmake

package info (click to toggle)
cmake 4.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 152,344 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (64 lines) | stat: -rw-r--r-- 2,617 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
enable_language(C)

include("${PYTHON_ARTIFACTS}")

set (components)
if (CHECK_INTERPRETER)
  set (required_interpreter "${Python3_EXECUTABLE}")
  list (APPEND components Interpreter)
endif()
if (CHECK_LIBRARY OR CHECK_INCLUDE)
  list (APPEND components Development)
  if (CHECK_LIBRARY)
    set (required_library "${Python3_LIBRARY}")
  endif()
  if (CHECK_INCLUDE)
    set (required_include "${Python3_INCLUDE_DIR}")
  endif()
endif()
if (CHECK_SABI_LIBRARY)
  list (APPEND components Development.SABIModule)
  set (required_sabi_library "${Python3_SABI_LIBRARY}")
endif()

find_package (Python3 COMPONENTS ${components})


if (PYTHON_IS_FOUND AND NOT Python3_FOUND)
  message (FATAL_ERROR "Python3 unexpectedly not found")
endif()
if (NOT PYTHON_IS_FOUND AND Python3_FOUND)
  message (FATAL_ERROR "Python3 unexpectedly found")
endif()

if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter)
  message (FATAL_ERROR "Failed to use input variable Python3_EXECUTABLE")
endif()

if (CHECK_LIBRARY AND PYTHON_IS_FOUND AND
    (NOT Python3_LIBRARY_RELEASE STREQUAL PYTHON_LIBRARY_RELEASE
      OR (WIN32 AND NOT Python3_RUNTIME_LIBRARY_RELEASE STREQUAL PYTHON_RUNTIME_LIBRARY_RELEASE)
      OR (PYTHON_LIBRARY_DEBUG AND NOT Python3_LIBRARY_DEBUG STREQUAL PYTHON_LIBRARY_DEBUG)
      OR (WIN32 AND PYTHON_RUNTIME_LIBRARY_DEBUG AND NOT Python3_RUNTIME_LIBRARY_DEBUG STREQUAL PYTHON_RUNTIME_LIBRARY_DEBUG)))
  message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
endif()
if (CHECK_LIBRARY AND NOT PYTHON_IS_FOUND AND
    NOT Python3_LIBRARY_RELEASE STREQUAL required_library)
  message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY")
endif()

if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include)
  message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR")
endif()

if (CHECK_SABI_LIBRARY AND PYTHON_IS_FOUND AND
    (NOT Python3_SABI_LIBRARY_RELEASE STREQUAL PYTHON_SABI_LIBRARY_RELEASE
      OR (WIN32 AND NOT Python3_RUNTIME_SABI_LIBRARY_RELEASE STREQUAL PYTHON_RUNTIME_SABI_LIBRARY_RELEASE)
      OR (PYTHON_SABI_LIBRARY_DEBUG AND NOT Python3_SABI_LIBRARY_DEBUG STREQUAL PYTHON_SABI_LIBRARY_DEBUG)
      OR (WIN32 AND PYTHON_RUNTIME_SABI_LIBRARY_DEBUG AND NOT Python3_RUNTIME_SABI_LIBRARY_DEBUG STREQUAL PYTHON_RUNTIME_SABI_LIBRARY_DEBUG)))
  message (FATAL_ERROR "Failed to use input variable Python3_SABI_LIBRARY")
endif()
if (CHECK_SABI_LIBRARY AND NOT PYTHON_IS_FOUND AND
    NOT Python3_SABI_LIBRARY_RELEASE STREQUAL required_sabi_library)
    message (FATAL_ERROR "Failed to use input variable Python3_SABI_LIBRARY")
endif()