Skip to content

Commit

Permalink
CMakeLists.txt - Disable QtQuick on older MacOS and newer Qt
Browse files Browse the repository at this point in the history
Newer Qt versions don't work well with older MacOS
  • Loading branch information
Allen Winter committed Mar 6, 2020
1 parent 56ee460 commit e11959c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ if(BAD_CXX_MESSAGE)
message(FATAL_ERROR "\nSorry, ${BAD_CXX_MESSAGE} is required to build this software. Please retry using a modern compiler that supports C++11.")
endif()

set(MACOS_DISABLE_UNSUPPORTED_TESTS FALSE)
if(APPLE)
cmake_host_system_information(RESULT MACOS_RELEASE QUERY OS_RELEASE)
if(MACOS_RELEASE VERSION_GREATER_EQUAL 10.15.0 AND Qt5Quick_VERSION VERSION_LESS 5.12.0)
# Qt Quick is only supported on macOS Catalina using Qt 5.12 and above
set(MACOS_DISABLE_UNSUPPORTED_TESTS TRUE)
message(STATUS "WARNING: Your version of MacOS is too old (less then 10.15) to use with QtQuick 5.12 or higher. You can solve this by upgrading your MacOS or using older Qt versions. Disabling QtQuick capabilities.")
endif()
endif()

if(MSVC AND MSVC_VERSION VERSION_EQUAL 1800)
# MSVC 2013 implements some C++11 features only partially, which is why cmake
# doesn't list these features as supported, still support is good enough for us.
Expand Down Expand Up @@ -407,6 +417,10 @@ find_package(Qt5 NO_MODULE QUIET OPTIONAL_COMPONENTS
Widgets
WaylandCompositor
)
if(MACOS_DISABLE_UNSUPPORTED_TESTS)
set(Qt5Quick_FOUND FALSE)
endif()

# Find these 'exotic' Qt modules without using find_package(... COMPONENTS)
# so we can retrieve those packages even when installed into a different prefix
find_package(Qt5IviCore 1.1 NO_MODULE QUIET) # 1.1 is based on 5.8
Expand Down
17 changes: 4 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ if(Qt5Quick_FOUND)
endif()
endif()

set(MACOS_DISABLE_UNSUPPORTED_TESTS FALSE)
if(APPLE)
cmake_host_system_information(RESULT MACOS_RELEASE QUERY OS_RELEASE)
if(MACOS_RELEASE VERSION_GREATER_EQUAL 10.15.0 AND Qt5Quick_VERSION VERSION_LESS 5.12.0)
# Qt Quick is only supported on macOS Catalina using Qt 5.12 and above
set(MACOS_DISABLE_UNSUPPORTED_TESTS TRUE)
endif()
endif()

add_subdirectory(shared)
add_subdirectory(manual)
add_subdirectory(targets)
Expand Down Expand Up @@ -192,10 +183,10 @@ target_link_libraries(metaobjecttest gammaray_core)
gammaray_add_probe_test(problemreportertest problemreportertest.cpp $<TARGET_OBJECTS:modeltestobj>)
target_link_libraries(problemreportertest gammaray_core)
if(Qt5Qml_FOUND)
target_link_libraries(problemreportertest Qt5::Qml)
target_link_libraries(problemreportertest Qt5::Qml)
endif()
if (Qt5Widgets_FOUND)
target_link_libraries(problemreportertest Qt5::Widgets)
if(Qt5Widgets_FOUND)
target_link_libraries(problemreportertest Qt5::Widgets)
endif()

gammaray_add_test(objectinstancetest objectinstancetest.cpp)
Expand Down Expand Up @@ -427,7 +418,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
endif()
endif()

if(Qt5Quick_FOUND AND NOT MACOS_DISABLE_UNSUPPORTED_TESTS)
if(Qt5Quick_FOUND)
gammaray_add_quick_test(quickinspectortest
quickinspectortest.cpp
quickinspectortest.qrc
Expand Down

0 comments on commit e11959c

Please sign in to comment.