File: FindPythonSiteLibs.cmake

package info (click to toggle)
pam-wrapper 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 584 kB
  • ctags: 383
  • sloc: ansic: 4,257; python: 109; makefile: 6
file content (56 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download | duplicates (5)
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
#.rst:
# FindPythonSiteLibs
# --------------
#
# Find the location of python site libraries
#
# ::
#
# PYTHON_SITELIB        = path to the sitelib install directory
# PYTHON_SITEINC        = path to the siteinc install directory
#
# Note that these variable do not have a prefix set. So you should for example
# prepend the CMAKE_INSTALL_PREFIX.

#=============================================================================
# Copyright 2015      Andreas Schneider <asn@cryptomilk.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

if (PYTHON_EXECUTABLE)
    ### PYTHON_SITELIB
    execute_process(
        COMMAND
        ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))"
        OUTPUT_VARIABLE
            PYTHON_SITELIB_OUTPUT_VARIABLE
        RESULT_VARIABLE
            PYTHON_SITELIB_RESULT_VARIABLE
        OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    if (NOT PYTHON_SITELIB_RESULT_VARIABLE)
        file(TO_CMAKE_PATH "${PYTHON_SITELIB_OUTPUT_VARIABLE}" PYTHON_SITELIB)
    endif ()

    ### PYTHON_SITEINC
    execute_process(
        COMMAND
            ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(plat_specific=True, prefix=''))"
        OUTPUT_VARIABLE
            PYTHON_SITEINC_OUTPUT_VARIABLE
        RESULT_VARIABLE
            PYTHON_SITEINC_RESULT_VARIABLE
        OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    if (NOT PYTHON_SITEINC_RESULT_VARIABLE)
        file(TO_CMAKE_PATH "${PYTHON_SITEINC_OUTPUT_VARIABLE}" PYTHON_SITEINC)
    endif ()
endif (PYTHON_EXECUTABLE)