4 # SIP website: http://www.riverbankcomputing.co.uk/sip/index.php
6 # Find the installed version of SIP. FindSIP should be called after Python
9 # This file defines the following variables:
11 # SIP_VERSION - The version of SIP found expressed as a 6 digit hex number
12 # suitable for comparison as a string.
14 # SIP_VERSION_STR - The version of SIP found as a human readable string.
16 # SIP_EXECUTABLE - Path and filename of the SIP command line executable.
18 # SIP_INCLUDE_DIR - Directory holding the SIP C++ header file.
20 # SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed
23 # Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
24 # Redistribution and use is allowed according to the terms of the BSD license.
25 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
30 # Already in cache, be silent
34 FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH})
36 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config)
38 STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
39 STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
40 STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_EXECUTABLE ${sip_config})
41 IF(NOT SIP_DEFAULT_SIP_DIR)
42 STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
43 ENDIF(NOT SIP_DEFAULT_SIP_DIR)
44 STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config})
45 FILE(TO_CMAKE_PATH ${SIP_DEFAULT_SIP_DIR} SIP_DEFAULT_SIP_DIR)
46 FILE(TO_CMAKE_PATH ${SIP_INCLUDE_DIR} SIP_INCLUDE_DIR)
47 IF(EXISTS ${SIP_EXECUTABLE})
50 MESSAGE(STATUS "Found SIP configuration but the sip executable could not be found.")
55 IF(NOT SIP_FIND_QUIETLY)
56 MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
57 ENDIF(NOT SIP_FIND_QUIETLY)
60 MESSAGE(FATAL_ERROR "Could not find SIP")
61 ENDIF(SIP_FIND_REQUIRED)