Skip to content

Commit

Permalink
Improve FindQScintilla.cmake functioning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
scottfurry authored and MKleusberg committed Mar 6, 2019
1 parent 1cf95ec commit b4af221
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
18 changes: 16 additions & 2 deletions cmake/FindQScintilla.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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} )
Expand Down

0 comments on commit b4af221

Please sign in to comment.