Salome HOME
03e63e45d734714672f81745e6b354a87f1c1755
[tools/configuration.git] / cmake / FindOmniORBPy.cmake
1 # - Find OmniORB4 Python backend
2 #
3 # Sets the following variables:
4 # OMNIORB_PYTHON_BACKEND - path to the Python backend
5 # OMNIORBPY_PYTHONPATH   - Python path to the OmniORB modules
6 #
7 # Detection is made by looking for  
8 #    lib/python${_py_version}/site-packages/omniidl_be/python.py
9 #
10
11 ################################################################
12 # Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
13 #
14 # This library is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU Lesser General Public
16 # License as published by the Free Software Foundation; either
17 # version 2.1 of the License, or (at your option) any later version.
18 #
19 # This library is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 # Lesser General Public License for more details.
23 #
24 # You should have received a copy of the GNU Lesser General Public
25 # License along with this library; if not, write to the Free Software
26 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
27 #
28 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
29 #
30
31 ##############################################################################
32 # find python back-end
33 ##############################################################################
34
35 SET(_py_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
36 FIND_PATH(OMNIORB_PYTHON_BACKEND
37   NAMES python.py
38   PATHS "${OMNIORBPY_ROOT_DIR}" "/usr" 
39   PATH_SUFFIXES "/lib/python${_py_version}/site-packages/omniidl_be" "/lib/omniidl/omniidl_be" "/lib/python/omniidl_be"
40   DOC "Path to python-backend directory (omniidl_be) including python.py file")
41
42 FIND_PATH(OMNIORBPY_INCLUDE_DIR
43   NAMES omniORBpy.h
44   PATHS "${OMNIORBPY_ROOT_DIR}" "/usr"
45   PATHS_SUFFIXES "/include"
46   DOC "Path to omniORBpy include directory")
47
48 ##############################################################################
49 # Cook our stuff
50 ##############################################################################
51 MARK_AS_ADVANCED(OMNIORB_PYTHON_BACKEND)
52 MARK_AS_ADVANCED(OMNIORBPY_INCLUDE_DIR)
53   
54 SET(OMNIORB_IDLPYFLAGS)
55 IF (OMNIORB_PYTHON_BACKEND) 
56   LIST(APPEND OMNIORB_IDLPYFLAGS -bpython -p${OMNIORB_PYTHON_BACKEND})
57 ENDIF()
58 SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
59
60 GET_FILENAME_COMPONENT(OMNIORBPY_PYTHONPATH "${OMNIORB_PYTHON_BACKEND}" PATH)
61
62 # Handle standard arguments:
63 INCLUDE(FindPackageHandleStandardArgs)
64 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORBPy REQUIRED_VARS OMNIORB_PYTHON_BACKEND OMNIORBPY_INCLUDE_DIR)