FindPythonLibs3.cmake 966 Bytes
Newer Older
Minh Ngo's avatar
Minh Ngo committed
1
2
3
4
5
6
7
find_package(PkgConfig)
pkg_check_modules(PYTHONLIBS3 QUIET python3)
set(PYTHONLIBS3_DEFINITIONS ${PYTHONLIBS3_CFLAGS_OTHER})

find_path(PYTHONLIBS3_INCLUDE_DIR Python.h
          HINTS ${PYTHONLIBS3_INCLUDEDIR} ${PYTHONLIBS3_INCLUDE_DIRS})

8
9
10
11
12
13
14
IF(WIN32)
  find_library(PYTHONLIBS3_LIBRARY NAMES python32 python33 python34 python35 python36 python37
               HINTS ${PYTHONLIBS3_LIBDIR} ${PYTHONLIBS3_LIBRARY_DIRS} )
ELSE()
  find_library(PYTHONLIBS3_LIBRARY NAMES python3.2m python3.3m python3.4m python3.5m python3.6m python3.7m
               HINTS ${PYTHONLIBS3_LIBDIR} ${PYTHONLIBS3_LIBRARY_DIRS} )
ENDIF()
Minh Ngo's avatar
Minh Ngo committed
15
16
17
18
19

set(PYTHONLIBS3_LIBRARIES ${PYTHONLIBS3_LIBRARY} )
set(PYTHONLIBS3_INCLUDE_DIRS ${PYTHONLIBS3_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
20
find_package_handle_standard_args(PythonLibs3  DEFAULT_MSG
Minh Ngo's avatar
Minh Ngo committed
21
22
23
                                  PYTHONLIBS3_LIBRARY PYTHONLIBS3_INCLUDE_DIR)

mark_as_advanced(PYTHONLIBS3_INCLUDE_DIR PYTHONLIBS3_LIBRARY)