CMake: Make sure Qt5 is also found on OS X after installing it via Homebrew
authorWuzzy <Wuzzy2@mail.ru>
Fri, 30 Mar 2018 15:16:29 +0200
changeset 13299 6fda879d5052
parent 13298 4e4c19ca63a8
child 13300 d3f43e34fc47
CMake: Make sure Qt5 is also found on OS X after installing it via Homebrew
QTfrontend/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt	Fri Mar 30 15:02:10 2018 +0200
+++ b/QTfrontend/CMakeLists.txt	Fri Mar 30 15:16:29 2018 +0200
@@ -1,3 +1,12 @@
+if(APPLE AND EXISTS /usr/local/opt/qt5)
+	# Special treatment for OS X users who
+	# install Qt5 via Homebrew.
+	# Homebrew installs Qt5 (up to at least 5.9.1) in
+	# /usr/local/qt5, ensure it can be found by CMake since
+	# it is not in the default /usr/local prefix.
+	list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
+endif()
+
 find_package(Qt5 COMPONENTS Core Widgets Gui Network)
 
 include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})