Salome HOME
CMake: wrote a safer command for the PyQt4 executable
[modules/gui.git] / adm_local / cmake_files / FindSIP.cmake
1 # - Find SIP
2 # Sets the following variables:
3 #   SIP_EXECUTABLE      - path to the SIP executable
4 #   SIP_INCLUDE_DIR     - path to the SIP headers
5 #   SIP_PYTHON_PATH     - path to the SIP Python packages
6 #
7 #  The header sip.h is looked for.
8 #  The binary 'sip' is looked for.
9 #
10
11 #########################################################################
12 # Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
13 #
14 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
15 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
16 #
17 # This library is free software; you can redistribute it and/or
18 # modify it under the terms of the GNU Lesser General Public
19 # License as published by the Free Software Foundation; either
20 # version 2.1 of the License.
21 #
22 # This library is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 # Lesser General Public License for more details.
26 #
27 # You should have received a copy of the GNU Lesser General Public
28 # License along with this library; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
30 #
31 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
32 #
33
34 IF(NOT SIP_FIND_QUIETLY)
35   MESSAGE(STATUS "Looking for SIP ...")
36 ENDIF()
37
38 FIND_PROGRAM(SIP_EXECUTABLE sip)
39 FIND_PATH(SIP_INCLUDE_DIR sip.h PATH_SUFFIXES python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
40
41 IF(SIP_INCLUDE_DIR)
42   GET_FILENAME_COMPONENT(SIP_PYTHONPATH "${SIP_INCLUDE_DIR}" PATH)
43   GET_FILENAME_COMPONENT(SIP_PYTHONPATH "${SIP_PYTHONPATH}" PATH)
44   SET(SIP_PYTHONPATH "${SIP_PYTHONPATH}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
45 ENDIF()
46
47 INCLUDE(FindPackageHandleStandardArgs)
48 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SIP REQUIRED_VARS SIP_INCLUDE_DIR SIP_EXECUTABLE SIP_PYTHONPATH)
49
50