diff options
author | Jonathan Riddell <jr@jriddell.org> | 2014-07-17 17:17:50 +0200 |
---|---|---|
committer | Jonathan Riddell <jr@jriddell.org> | 2014-07-17 17:17:50 +0200 |
commit | 0912b2468881286b508915b17d204f1c17fc93dd (patch) | |
tree | e1a33c858f0a7e37824f16996bfd832b5eee5d64 /attic/modules/FindPyQt4.cmake | |
parent | 14a983f26ae0c39eb9f66312f6e25e91527194e7 (diff) | |
download | extra-cmake-modules-0912b2468881286b508915b17d204f1c17fc93dd.tar.gz extra-cmake-modules-0912b2468881286b508915b17d204f1c17fc93dd.tar.bz2 |
forward port https://git.reviewboard.kde.org/r/119302 "Make FindPyQt4 work with PyQt's new build system."
REVIEW:119339
Diffstat (limited to 'attic/modules/FindPyQt4.cmake')
-rw-r--r-- | attic/modules/FindPyQt4.cmake | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/attic/modules/FindPyQt4.cmake b/attic/modules/FindPyQt4.cmake index 37f645ea..c0cb108e 100644 --- a/attic/modules/FindPyQt4.cmake +++ b/attic/modules/FindPyQt4.cmake @@ -9,7 +9,8 @@ # Find the installed version of PyQt4. FindPyQt4 should only be called after # Python has been found. # -# This file defines the following variables: +# This file defines the following variables, which can also be overriden by +# users: # # PYQT4_VERSION - The version of PyQt4 found expressed as a 6 digit hex number # suitable for comparision as a string @@ -18,7 +19,10 @@ # # PYQT4_VERSION_TAG - The PyQt version tag using by PyQt's sip files. # -# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files. +# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files. This can be unset +# if PyQt4 was built using its new build system and pyqtconfig.py is not +# present on the system, as in this case its value cannot be determined +# automatically. # # PYQT4_SIP_FLAGS - The SIP flags used to build PyQt. @@ -31,13 +35,27 @@ ELSE(EXISTS PYQT4_VERSION) EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_pyqt_py} OUTPUT_VARIABLE pyqt_config) IF(pyqt_config) - STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config}) - STRING(REGEX REPLACE ".*\npyqt_version_str:([^\n]+).*$" "\\1" PYQT4_VERSION_STR ${pyqt_config}) - STRING(REGEX REPLACE ".*\npyqt_version_tag:([^\n]+).*$" "\\1" PYQT4_VERSION_TAG ${pyqt_config}) - STRING(REGEX REPLACE ".*\npyqt_sip_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config}) - STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${pyqt_config}) + STRING(REGEX MATCH "^pyqt_version:([^\n]+).*$" _dummy ${pyqt_config}) + SET(PYQT4_VERSION "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a 6-digit hexadecimal number") - SET(PYQT4_FOUND TRUE) + STRING(REGEX MATCH ".*\npyqt_version_str:([^\n]+).*$" _dummy ${pyqt_config}) + SET(PYQT4_VERSION_STR "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a human-readable string") + + STRING(REGEX MATCH ".*\npyqt_version_tag:([^\n]+).*$" _dummy ${pyqt_config}) + SET(PYQT4_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt4 version tag used by PyQt4's .sip files") + + STRING(REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${pyqt_config}) + SET(PYQT4_SIP_DIR "${CMAKE_MATCH_1}" CACHE FILEPATH "The base directory where PyQt4's .sip files are installed") + + STRING(REGEX MATCH ".*\npyqt_sip_flags:([^\n]+).*$" _dummy ${pyqt_config}) + SET(PYQT4_SIP_FLAGS "${CMAKE_MATCH_1}" CACHE STRING "The SIP flags used to build PyQt4") + + IF(NOT IS_DIRECTORY PYQT4_SIP_DIR) + MESSAGE(WARNING "The base directory where PyQt4's SIP files are installed could not be determined. This usually means PyQt4 was built with its new build system and pyqtconfig.py is not present.\n" + "Please set the PYQT4_SIP_DIR variable manually.") + ELSE(NOT PYQT4_SIP_DIR) + SET(PYQT4_FOUND TRUE) + ENDIF(NOT PYQT4_SIP_DIR) ENDIF(pyqt_config) IF(PYQT4_FOUND) |