Skip to content

Commit

Permalink
Flip CMake finds for Qt-based frameworks, to ensure Headers are searched
Browse files Browse the repository at this point in the history
Search for libraries first, before includes, so any frameworks found can
have their Headers subdirectory added to search paths for includes.

- Reintroduce qwt and qscintilla2 base library names for searching.
  • Loading branch information
dakcarto committed Nov 24, 2016
1 parent 95072e9 commit d187dd3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 34 deletions.
11 changes: 5 additions & 6 deletions cmake/FindQCA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ else(QCA_INCLUDE_DIR AND QCA_LIBRARY)
/usr/local/lib
)

if(APPLE)
if(QCA_LIBRARY AND QCA_LIBRARY MATCHES "qca(2)?-qt5\\.framework")
set(QCA_LIBRARY "${QCA_LIBRARY}" CACHE FILEPATH "QCA framework" FORCE)
set(QCA_INCLUDE_DIR "${QCA_LIBRARY}/Headers" CACHE FILEPATH "QCA framework headers" FORCE)
endif()
endif(APPLE)
set(_qca_fw)
if(QCA_LIBRARY MATCHES "/qca.*\\.framework")
string(REGEX REPLACE "^(.*/qca.*\\.framework).*$" "\\1" _qca_fw "${QCA_LIBRARY}")
endif()

find_path(QCA_INCLUDE_DIR
NAMES QtCrypto
PATHS
"${_qca_fw}/Headers"
${LIB_DIR}/include
"$ENV{LIB_DIR}/include"
$ENV{INCLUDE}
Expand Down
33 changes: 23 additions & 10 deletions cmake/FindQScintilla.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ IF(EXISTS QSCINTILLA_VERSION_STR)
SET(QSCINTILLA_FOUND TRUE)
ELSE(EXISTS QSCINTILLA_VERSION_STR)

FIND_PATH(QSCINTILLA_INCLUDE_DIR
NAMES Qsci/qsciglobal.h
PATHS
${Qt5Core_INCLUDE_DIRS}
"${QT_INCLUDE_DIR}"
/usr/local/include
/usr/include
)

set(QSCINTILLA_LIBRARY_NAMES qscintilla2-qt5 libqt5scintilla2 libqscintilla2-qt5 qt5scintilla2 libqscintilla2-qt5.dylib)
set(QSCINTILLA_LIBRARY_NAMES
qscintilla2-qt5
libqt5scintilla2
libqscintilla2-qt5
qt5scintilla2
libqscintilla2-qt5.dylib
qscintilla2
)

find_library(QSCINTILLA_LIBRARY
NAMES ${QSCINTILLA_LIBRARY_NAMES}
Expand All @@ -43,6 +41,21 @@ ELSE(EXISTS QSCINTILLA_VERSION_STR)
/usr/lib
)

set(_qsci_fw)
if(QSCINTILLA_LIBRARY MATCHES "/qscintilla.*\\.framework")
string(REGEX REPLACE "^(.*/qscintilla.*\\.framework).*$" "\\1" _qsci_fw "${QSCINTILLA_LIBRARY}")
endif()

FIND_PATH(QSCINTILLA_INCLUDE_DIR
NAMES Qsci/qsciglobal.h
PATHS
"${_qsci_fw}/Headers"
${Qt5Core_INCLUDE_DIRS}
"${QT_INCLUDE_DIR}"
/usr/local/include
/usr/include
)

IF(QSCINTILLA_LIBRARY AND QSCINTILLA_INCLUDE_DIR)
SET(QSCINTILLA_FOUND TRUE)

Expand Down
24 changes: 15 additions & 9 deletions cmake/FindQwt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
#


FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
/usr/include
/usr/local/include
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
PATH_SUFFIXES qwt-qt4 qwt qwt5 qwt6
)

set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5)
set(QWT_LIBRARY_NAMES qwt-qt5 qwt6-qt5 qwt)

find_library(QWT_LIBRARY
NAMES ${QWT_LIBRARY_NAMES}
Expand All @@ -31,6 +23,20 @@ find_library(QWT_LIBRARY
"$ENV{LIB}"
)

set(_qwt_fw)
if(QWT_LIBRARY MATCHES "/qwt.*\\.framework")
string(REGEX REPLACE "^(.*/qwt.*\\.framework).*$" "\\1" _qwt_fw "${QWT_LIBRARY}")
endif()

FIND_PATH(QWT_INCLUDE_DIR NAMES qwt.h PATHS
"${_qwt_fw}/Headers"
/usr/include
/usr/local/include
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
PATH_SUFFIXES qwt-qt4 qwt qwt5 qwt6
)

IF (QWT_INCLUDE_DIR AND QWT_LIBRARY)
SET(QWT_FOUND TRUE)
ENDIF (QWT_INCLUDE_DIR AND QWT_LIBRARY)
Expand Down
23 changes: 14 additions & 9 deletions cmake/FindQwtPolar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,27 @@
# QWTPOLAR_INCLUDE_DIR = where to find headers
#


FIND_PATH(QWTPOLAR_INCLUDE_DIR NAMES qwt_polar.h PATHS
/usr/include
/usr/local/include
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
PATH_SUFFIXES qwtpolar qwt
)

FIND_LIBRARY(QWTPOLAR_LIBRARY NAMES qwtpolar PATHS
/usr/lib
/usr/local/lib
"$ENV{LIB_DIR}/lib"
"$ENV{LIB}/lib"
)

SET(_qwtpolar_fw)
IF (QWTPOLAR_LIBRARY MATCHES "/qwtpolar.*\\.framework")
STRING(REGEX REPLACE "^(.*/qwtpolar.*\\.framework).*$" "\\1" _qwtpolar_fw "${QWTPOLAR_LIBRARY}")
ENDIF ()

FIND_PATH(QWTPOLAR_INCLUDE_DIR NAMES qwt_polar.h PATHS
"${_qwtpolar_fw}/Headers"
/usr/include
/usr/local/include
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
PATH_SUFFIXES qwtpolar qwt
)

IF (QWTPOLAR_INCLUDE_DIR AND QWTPOLAR_LIBRARY)
SET(QWTPOLAR_FOUND TRUE)
ENDIF (QWTPOLAR_INCLUDE_DIR AND QWTPOLAR_LIBRARY)
Expand Down

0 comments on commit d187dd3

Please sign in to comment.