summaryrefslogtreecommitdiff
path: root/cmake/FindPython.cmake
blob: 8f3434a0436fb9ce43de6ea3f0f34a6d0ee9caeb (plain)
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
#
# Copyright (C) 2003-2021 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2009 Julien Louis <ptitlouis@sysif.net>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat.  If not, see <https://www.gnu.org/licenses/>.
#

# - Find Python
# This module finds if Python is installed and determines where the include files
# and libraries are. It also determines what the name of the library is. This
# code sets the following variables:
#
#  PYTHON_EXECUTABLE   = full path to the python binary
#  PYTHON_INCLUDE_DIRS = path to where python.h can be found
#  PYTHON_LIBRARIES = path to where libpython.so* can be found
#  PYTHON_LDFLAGS = python compiler options for linking

include(FindPkgConfig)

if(ENABLE_PYTHON2)
  pkg_check_modules(PYTHON python2 IMPORTED_TARGET GLOBAL)
else()
  pkg_check_modules(PYTHON python3-embed IMPORTED_TARGET GLOBAL)
  if(NOT PYTHON_FOUND)
    pkg_check_modules(PYTHON python3 IMPORTED_TARGET GLOBAL)
  endif()
endif()