From b4af221ee11c6b8df47f6a7b24d5efc1221721c2 Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Mon, 4 Mar 2019 17:36:37 -0700 Subject: [PATCH] Improve FindQScintilla.cmake functioning Changes depend on successful find_package(Qt5...) call and when building against external QScintilla. Modified FindQScintilla.cmake providing extra hints of locations to search for needed header files. Hints include paths based on where Qt5 is installed. Presuming Unix/Linux distributions will put QScintilla header files under Qt5 header folders. --- CMakeLists.txt | 6 +++--- cmake/FindQScintilla.cmake | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e3d3e9b..1e50d1a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,11 +61,13 @@ if(WIN32 AND MSVC) set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}") endif() +find_package(Qt5 REQUIRED COMPONENTS Concurrent Gui LinguistTools Network PrintSupport Test Widgets Xml) + if(NOT FORCE_INTERNAL_ANTLR) find_package(Antlr2 QUIET) endif() if(NOT FORCE_INTERNAL_QSCINTILLA) - find_package(QScintilla QUIET) + find_package(QScintilla 2.8.10 QUIET) endif() set(QHEXEDIT_DIR libs/qhexedit) @@ -82,8 +84,6 @@ endif() add_subdirectory(${QHEXEDIT_DIR}) add_subdirectory(${QCUSTOMPLOT_DIR}) -find_package(Qt5 REQUIRED COMPONENTS Concurrent Gui LinguistTools Network PrintSupport Test Widgets Xml) - set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/cmake/FindQScintilla.cmake b/cmake/FindQScintilla.cmake index 082b94f1..4d231774 100644 --- a/cmake/FindQScintilla.cmake +++ b/cmake/FindQScintilla.cmake @@ -42,9 +42,23 @@ # either expressed or implied, of the FreeBSD Project. #============================================================================= - +# When using pkg-config, paths may contain odd slash placement. Each +# include directory is pre-processed here. Resultant list variable +# then used for search hinting. Depends on successful find_package(Qt5). +set(Qt5QScintillaHintDirs) +if(UNIX) + foreach(item ${Qt5Widgets_INCLUDE_DIRS}) + # remove slash at end of line + STRING(REGEX REPLACE "\\/$" "" item ${item}) + # replace double slashes is single slashes + STRING(REGEX REPLACE "\\/\\/" "/" item ${item}) + list(APPEND Qt5QScintillaHintDirs "${item}/Qsci") + endforeach() +endif() find_path ( QSCINTILLA_INCLUDE_DIR qsciscintilla.h - HINTS /usr/local/include/Qsci /usr/local/opt/qscintilla2/include/Qsci + HINTS /usr/local/include/Qsci + /usr/local/opt/qscintilla2/include/Qsci + ${Qt5QScintillaHintDirs} ) set ( QSCINTILLA_INCLUDE_DIRS ${QSCINTILLA_INCLUDE_DIR} )