]> SALOME platform Git repositories - modules/shaper.git/blob - CMakeCommon/FindPython.cmake
Salome HOME
Issue #2561: CEA 2018-1 Cut
[modules/shaper.git] / CMakeCommon / FindPython.cmake
1 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 UNSET(PYTHON_INCLUDE_DIRS)
4 UNSET(PYTHON_LIBRARIES)
5
6 IF(WIN32)
7     IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
8       SET(PYTHON_LIBRARY_FILE "python27_d.lib")
9     ElSE()
10       SET(PYTHON_LIBRARY_FILE "python27.lib")
11     ENDIF()
12 ElSE()
13     SET(PYTHON_LIBRARY_FILE "libpython2.7.so")
14 ENDIF()
15
16 IF($ENV{PYTHONHOME})
17   IF(WIN32)
18     FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/libs/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
19   ElSE()
20     FILE(TO_CMAKE_PATH "$ENV{PYTHONHOME}/lib/${PYTHON_LIBRARY_FILE}" PATH_PYTHON_LIBRARY)
21   ENDIF()
22   SET(PYTHON_LIBRARY ${PATH_PYTHON_LIBRARY} CACHE FILEPATH "path to the python library" FORCE)
23 ENDIF()
24
25 IF($ENV{PYTHON_INCLUDE})
26   FILE(TO_CMAKE_PATH $ENV{PYTHON_INCLUDE} PATH_PYTHON_INCLUDE_DIR)
27   SET(PYTHON_INCLUDE_DIR ${PATH_PYTHON_INCLUDE_DIR} CACHE PATH "path to where Python.h is found" FORCE)
28 ENDIF()
29
30 FIND_PACKAGE(PythonLibs REQUIRED)
31 FIND_PACKAGE(PythonInterp REQUIRED)
32
33 INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})