FindPythonLibs3.cmake 985 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
IF(WIN32)
Rex Dieter's avatar
Rex Dieter committed
9
  find_library(PYTHONLIBS3_LIBRARY NAMES python32 python33 python34 python35 python36 python37 python38
10 11
               HINTS ${PYTHONLIBS3_LIBDIR} ${PYTHONLIBS3_LIBRARY_DIRS} )
ELSE()
Rex Dieter's avatar
Rex Dieter committed
12
  find_library(PYTHONLIBS3_LIBRARY NAMES python3.2m python3.3m python3.4m python3.5m python3.6m python3.7m python3.8
13 14
               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)