summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-28 10:51:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-28 13:10:28 +0000
commit3c5ad626d4251d5a0d27138ae1d724786e2e1f6b (patch)
tree6e40a20337cfea933653c0122b5626b3aea79fcd /tests/auto/cmake
parent34af9fa0dc38ec19d85c0ef2464715b1e9661233 (diff)
Export modules' enabled/disabled features to cmake
Add properties enabled_features and disabled_features the respective library targets. This makes it possible to query the enabled classes in dependent libraries (for example, Qt for Python). Add a test verifying whether the Open GL configuration is reflected correctly in the feature properties to the existing test_opengl_lib autotest. Change-Id: I645c947073dbb36da3be81de6bc62ee0ba1e73d6 Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/test_opengl_lib/CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_opengl_lib/CMakeLists.txt b/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
index d9adb5a980..d2304a4183 100644
--- a/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
+++ b/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
@@ -8,11 +8,25 @@ find_package(Qt5Gui REQUIRED)
include_directories(${Qt5Gui_INCLUDE_DIRS} ${Qt5Gui_OPENGL_INCLUDE_DIRS} )
add_definitions(${Qt5Gui_DEFINITIONS})
+get_property(QtGui_enabled_features TARGET Qt5::Gui PROPERTY INTERFACE_QT_ENABLED_FEATURES)
+list(LENGTH QtGui_enabled_features _QtGui_enabled_featuresSize)
+if (_QtGui_enabled_featuresSize LESS 1)
+ message(SEND_ERROR "The INTERFACE_QT_ENABLED_FEATURES property of Qt5::Gui is empty!")
+endif()
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS}")
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
+ list(FIND QtGui_enabled_features "opengles2" _opengles2Index)
+ if(_opengles2Index EQUAL -1)
+ message(SEND_ERROR "The INTERFACE_QT_ENABLED_FEATURES property of Qt5::Gui does not contain the opengles2 feature!")
+ endif()
add_definitions(-DGL_IMPLEMENTATION_GLES2)
elseif (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GL)
+ list(FIND QtGui_enabled_features "opengl" _openglIndex)
+ if(_openglIndex EQUAL -1)
+ message(SEND_ERROR "The INTERFACE_QT_ENABLED_FEATURES property of Qt5::Gui does not contain the opengl feature!")
+ endif()
add_definitions(-DGL_IMPLEMENTATION_GL)
else()
message(SEND_ERROR "Qt5Gui_OPENGL_IMPLEMENTATION does not contain valid data.")