|
| 1 | +# Find QScintilla2 PyQt4 module |
| 2 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3 | +# |
| 4 | +# QScintilla2 website: http://www.riverbankcomputing.co.uk/software/qscintilla/ |
| 5 | +# |
| 6 | +# Try to find the QScintilla2 includes and library |
| 7 | +# which defines |
| 8 | +# |
| 9 | +# QSCINTILLA_FOUND - system has QScintilla2 |
| 10 | +# QSCINTILLA_INCLUDE_DIR - where to find qextscintilla.h |
| 11 | +# QSCINTILLA_LIBRARY - where to find the QScintilla2 library |
| 12 | +# QSCINTILLA_VERSION_STR - version of library |
| 13 | + |
| 14 | +# copyright (c) 2007 Thomas Moenicke thomas.moenicke@kdemail.net |
| 15 | +# |
| 16 | +# Redistribution and use is allowed according to the terms of the FreeBSD license. |
| 17 | + |
| 18 | +# Edited by Larry Shaffer, 2012 |
| 19 | +# NOTE: include after check for Qt |
| 20 | + |
| 21 | + |
| 22 | +IF(EXISTS QSCINTILLA_VERSION_STR) |
| 23 | + # Already in cache, be silent |
| 24 | + SET(QSCINTILLA_FOUND TRUE) |
| 25 | +ELSE(EXISTS QSCINTILLA_VERSION_STR) |
| 26 | + |
| 27 | + FIND_PATH(QSCINTILLA_INCLUDE_DIR |
| 28 | + NAMES qsciglobal.h |
| 29 | + PATHS |
| 30 | + "${QT_INCLUDE_DIR}/Qsci" |
| 31 | + /usr/include |
| 32 | + /usr/include/Qsci |
| 33 | + /usr/local/include/Qsci |
| 34 | + ) |
| 35 | + |
| 36 | + FIND_LIBRARY(QSCINTILLA_LIBRARY |
| 37 | + NAMES qscintilla2 libqscintilla2 libqscintilla2.dylib |
| 38 | + PATHS |
| 39 | + "${QT_LIBRARY_DIR}" |
| 40 | + /usr/lib |
| 41 | + /usr/local/lib |
| 42 | + ) |
| 43 | + |
| 44 | + IF(QSCINTILLA_LIBRARY) |
| 45 | + # QSCINTILLA_INCLUDE_DIR is not required at this time (Oct 2012) since only |
| 46 | + # Qsci PyQt4 module is used, though lib is needed for Mac bundling |
| 47 | + SET(QSCINTILLA_FOUND TRUE) |
| 48 | + |
| 49 | + IF(CYGWIN) |
| 50 | + IF(BUILD_SHARED_LIBS) |
| 51 | + # No need to define QSCINTILLA_USE_DLL here, because it's default for Cygwin. |
| 52 | + ELSE(BUILD_SHARED_LIBS) |
| 53 | + SET (QSCINTILLA_DEFINITIONS -DQSCINTILLA_STATIC) |
| 54 | + ENDIF(BUILD_SHARED_LIBS) |
| 55 | + ENDIF(CYGWIN) |
| 56 | + ENDIF(QSCINTILLA_LIBRARY) |
| 57 | + |
| 58 | + IF(QSCINTILLA_INCLUDE_DIR AND NOT EXISTS QSCINTILLA_VERSION_STR) |
| 59 | + # get QScintilla2 version from header, is optinally retrieved via bindings |
| 60 | + # with Qsci PyQt4 module |
| 61 | + FILE(READ ${QSCINTILLA_INCLUDE_DIR}/qsciglobal.h qsci_header) |
| 62 | + STRING(REGEX REPLACE "^.*QSCINTILLA_VERSION_STR +\"([^\"]+)\".*$" "\\1" QSCINTILLA_VERSION_STR "${qsci_header}") |
| 63 | + ENDIF(QSCINTILLA_INCLUDE_DIR AND NOT EXISTS QSCINTILLA_VERSION_STR) |
| 64 | + |
| 65 | + IF(QSCINTILLA_FOUND) |
| 66 | + IF(NOT QSCINTILLA_FIND_QUIETLY) |
| 67 | + MESSAGE(STATUS "Found QScintilla2: ${QSCINTILLA_LIBRARY} (${QSCINTILLA_VERSION_STR})") |
| 68 | + ENDIF(NOT QSCINTILLA_FIND_QUIETLY) |
| 69 | + ELSE(QSCINTILLA_FOUND) |
| 70 | + IF(QSCINTILLA_FIND_REQUIRED) |
| 71 | + MESSAGE(FATAL_ERROR "Could not find QScintilla2 library") |
| 72 | + ENDIF(QSCINTILLA_FIND_REQUIRED) |
| 73 | + ENDIF(QSCINTILLA_FOUND) |
| 74 | + |
| 75 | +ENDIF(EXISTS QSCINTILLA_VERSION_STR) |
| 76 | + |
| 77 | +#MARK_AS_ADVANCED(QSCINTILLA_INCLUDE_DIR QSCINTILLA_LIBRARY) |
| 78 | + |
0 commit comments