From f29d7b896f4757719c68b5ed14235ea64f4124cd Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 6 Jul 2021 14:00:45 +0200 Subject: [PATCH] Restore support for CMake < 3.11 Prior to CMake 3.11, the SOURCES could not be omitted when calling add_executable. This change ensures that SOURCES are passed, at least when building against Qt < 6.2. Change-Id: I83bd82fe12364523ce6954d145b632df7210d118 Reviewed-by: Christian Stenger --- src/libs/tracing/CMakeLists.txt | 22 +++++++++++-------- src/plugins/perfprofiler/CMakeLists.txt | 19 +++++++++------- src/plugins/qmlprofiler/CMakeLists.txt | 19 +++++++++------- .../tracing/flamegraphview/CMakeLists.txt | 11 +++++----- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt index cb46eb21b03..e44c9dc57b3 100644 --- a/src/libs/tracing/CMakeLists.txt +++ b/src/libs/tracing/CMakeLists.txt @@ -32,17 +32,13 @@ set(TRACING_CPP_SOURCES tracing_global.h ) -add_qtc_library(Tracing - FEATURE_INFO - DEPENDS Utils Qt5::Qml Qt5::Quick - PUBLIC_DEPENDS Qt5::Widgets - SOURCES - ${TEST_SOURCES} -) - if(${Qt5_VERSION} VERSION_LESS "6.2.0") - extend_qtc_library(Tracing + add_qtc_library(Tracing + FEATURE_INFO + DEPENDS Utils Qt5::Qml Qt5::Quick + PUBLIC_DEPENDS Qt5::Widgets SOURCES + ${TEST_SOURCES} ${TRACING_CPP_SOURCES} qml/tracing.qrc ) @@ -51,6 +47,14 @@ else() # < Qt 6.2 return() endif() + add_qtc_library(Tracing + FEATURE_INFO + DEPENDS Utils Qt5::Qml Qt5::Quick + PUBLIC_DEPENDS Qt5::Widgets + SOURCES + ${TEST_SOURCES} + ) + set(TRACING_QML_FILES qml/ButtonsBar.qml qml/CategoryLabel.qml diff --git a/src/plugins/perfprofiler/CMakeLists.txt b/src/plugins/perfprofiler/CMakeLists.txt index f7f6c91aa04..d83e9e65523 100644 --- a/src/plugins/perfprofiler/CMakeLists.txt +++ b/src/plugins/perfprofiler/CMakeLists.txt @@ -38,16 +38,12 @@ set(PERFPROFILER_CPP_SOURCES perftracepointdialog.cpp perftracepointdialog.h perftracepointdialog.ui ) -add_qtc_plugin(PerfProfiler - DEPENDS Tracing Qt5::QuickWidgets - PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport - SOURCES - ${TEST_SOURCES} -) - if(${Qt5_VERSION} VERSION_LESS "6.2.0") - extend_qtc_plugin(PerfProfiler + add_qtc_plugin(PerfProfiler + DEPENDS Tracing Qt5::QuickWidgets + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport SOURCES + ${TEST_SOURCES} ${PERFPROFILER_CPP_SOURCES} perfprofiler.qrc ) @@ -56,6 +52,13 @@ else() # < Qt 6.2 return() endif() + add_qtc_plugin(PerfProfiler + DEPENDS Tracing Qt5::QuickWidgets + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport + SOURCES + ${TEST_SOURCES} + ) + qt_add_resources(PerfProfiler perfprofiler PREFIX "/perfprofiler" tracepoints.sh diff --git a/src/plugins/qmlprofiler/CMakeLists.txt b/src/plugins/qmlprofiler/CMakeLists.txt index 295bc3d0bb9..c5fa5399f86 100644 --- a/src/plugins/qmlprofiler/CMakeLists.txt +++ b/src/plugins/qmlprofiler/CMakeLists.txt @@ -69,16 +69,12 @@ set(QMLPROFILER_CPP_SOURCES scenegraphtimelinemodel.cpp scenegraphtimelinemodel.h ) -add_qtc_plugin(QmlProfiler - DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets - PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor - SOURCES - ${TEST_SOURCES} -) - if(${Qt5_VERSION} VERSION_LESS "6.2.0") - extend_qtc_plugin(QmlProfiler + add_qtc_plugin(QmlProfiler + DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor SOURCES + ${TEST_SOURCES} ${QMLPROFILER_CPP_SOURCES} qml/qmlprofiler.qrc ) @@ -87,6 +83,13 @@ else() # < Qt 6.2 return() endif() + add_qtc_plugin(QmlProfiler + DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor + SOURCES + ${TEST_SOURCES} + ) + set(QMLPROFILER_QML_FILES qml/QmlProfilerFlameGraphView.qml ) diff --git a/tests/auto/tracing/flamegraphview/CMakeLists.txt b/tests/auto/tracing/flamegraphview/CMakeLists.txt index f64a90d4d3b..a1e900b7288 100644 --- a/tests/auto/tracing/flamegraphview/CMakeLists.txt +++ b/tests/auto/tracing/flamegraphview/CMakeLists.txt @@ -1,19 +1,20 @@ -add_qtc_test(tst_tracing_flamegraphview - DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils -) - set(TSTFLAMEGRAPHVIEW_CPP_SOURCES testflamegraphmodel.h tst_flamegraphview.cpp ) if(${Qt5_VERSION} VERSION_LESS "6.2.0") - extend_qtc_test(tst_tracing_flamegraphview + add_qtc_test(tst_tracing_flamegraphview + DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils SOURCES ${TSTFLAMEGRAPHVIEW_CPP_SOURCES} flamegraphview.qrc ) else() # < Qt 6.2 + add_qtc_test(tst_tracing_flamegraphview + DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils + ) + qt_add_qml_module(tst_tracing_flamegraphview URI "QtCreator.TstTracingFlameGraphView" VERSION "1.0"