diff options
author | Friedemann Kleint <[email protected]> | 2017-05-18 16:22:47 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2017-05-18 16:22:50 +0200 |
commit | d4112e4a6ea25aee831da3cd123f139b5f7229bf (patch) | |
tree | 9df72769796e5c4a1f64c1ef52ad2c00e7094a77 /CMakeLists.txt | |
parent | 352a80482b0afdc1df5acf526e4ada2c0d30b806 (diff) | |
parent | 3f45ae1bb3ad3ed433780731e87b0bf66558116d (diff) |
Change-Id: I8eeca2bbbf6662d0bdc9c3ef5f4018d9f4019159
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89d4dc7c..7c5ec97c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,12 +133,22 @@ if(CMAKE_HOST_APPLE) endif() endif() -if(NOT CMAKE_HOST_APPLE) - # Qt5: QT_INCLUDE_DIR does no longer exist. - # On Windows and Linux, it can be computed from Qt5Core_INCLUDE_DIRS - message("Qt5Core_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS}") - list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR) - message(STATUS "*** computed QT_INCLUDE_DIR as ${QT_INCLUDE_DIR}") +# Qt5: QT_INCLUDE_DIR does no longer exist. +# On Windows, macOS, and Linux it can be computed from Qt5Core_INCLUDE_DIRS, which contains +# a list of include directories. We take the first one. +message(STATUS "*** Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}") +list(GET Qt5Core_INCLUDE_DIRS 0 QT_INCLUDE_DIR) + +# On macOS, check if Qt is a framework build. This affects how include paths should be handled. +get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK) + +if (QtCore_is_framework) + get_filename_component(QT_FRAMEWORK_INCLUDE_DIR "${QT_INCLUDE_DIR}/../" ABSOLUTE) + message(STATUS "*** QT_FRAMEWORK_INCLUDE_DIR is ${QT_FRAMEWORK_INCLUDE_DIR}") + + # QT_INCLUDE_DIR points to the QtCore.framework directory, so need to adjust this to point + # to the actual include directory. + get_filename_component(QT_INCLUDE_DIR "${QT_INCLUDE_DIR}/../../include" ABSOLUTE) endif() if(MSVC) @@ -162,12 +172,14 @@ else() if (NOT QT_INCLUDE_DIR) set(QT_INCLUDE_DIR "/Library/Frameworks") endif() - if(ALTERNATIVE_QT_INCLUDE_DIR) + if(NOT QT_INCLUDE_DIR AND ALTERNATIVE_QT_INCLUDE_DIR) set(QT_INCLUDE_DIR ${ALTERNATIVE_QT_INCLUDE_DIR}) endif() string(REPLACE " " ":" QT_INCLUDE_DIR ${QT_INCLUDE_DIR}) endif() endif() +message(STATUS "*** computed QT_INCLUDE_DIR as ${QT_INCLUDE_DIR}") + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${SHIBOKEN_BUILD_TYPE}) |