forked from qt-creator/qt-creator
cmake build: Use qtc_add_resources for StudioWelcome
Avoids creating resource file if plugin is disabled. Change-Id: Ia3e1a127c49cae4b03547367a78ca7dd8c3689f3 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -774,19 +774,6 @@ function(finalize_qtc_gtest test_name exclude_sources_regex)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# This is the CMake equivalent of "RESOURCES = $$files()" from qmake
|
|
||||||
function(qtc_glob_resources)
|
|
||||||
cmake_parse_arguments(_arg "" "QRC_FILE;ROOT;GLOB" "" ${ARGN})
|
|
||||||
|
|
||||||
file(GLOB_RECURSE fileList RELATIVE "${_arg_ROOT}" "${_arg_ROOT}/${_arg_GLOB}")
|
|
||||||
set(qrcData "<RCC><qresource>\n")
|
|
||||||
foreach(file IN LISTS fileList)
|
|
||||||
string(APPEND qrcData " <file alias=\"${file}\">${_arg_ROOT}/${file}</file>\n")
|
|
||||||
endforeach()
|
|
||||||
string(APPEND qrcData "</qresource></RCC>")
|
|
||||||
file(WRITE "${_arg_QRC_FILE}" "${qrcData}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(qtc_copy_to_builddir custom_target_name)
|
function(qtc_copy_to_builddir custom_target_name)
|
||||||
cmake_parse_arguments(_arg "CREATE_SUBDIRS" "DESTINATION" "FILES;DIRECTORIES" ${ARGN})
|
cmake_parse_arguments(_arg "CREATE_SUBDIRS" "DESTINATION" "FILES;DIRECTORIES" ${ARGN})
|
||||||
set(timestampFiles)
|
set(timestampFiles)
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
set(qmlQrcFile "${CMAKE_CURRENT_BINARY_DIR}/StudioWelcome_qml.qrc")
|
|
||||||
|
|
||||||
qtc_glob_resources(
|
|
||||||
QRC_FILE "${qmlQrcFile}"
|
|
||||||
ROOT "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
GLOB "qml/*"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_qtc_plugin(StudioWelcome
|
add_qtc_plugin(StudioWelcome
|
||||||
DEPENDS Qt5::QuickWidgets
|
DEPENDS Qt5::QuickWidgets
|
||||||
PLUGIN_DEPENDS Core ProjectExplorer QtSupport
|
PLUGIN_DEPENDS Core ProjectExplorer QtSupport
|
||||||
@@ -14,8 +6,15 @@ add_qtc_plugin(StudioWelcome
|
|||||||
studiowelcomeplugin.cpp studiowelcomeplugin.h
|
studiowelcomeplugin.cpp studiowelcomeplugin.h
|
||||||
studiowelcome_global.h
|
studiowelcome_global.h
|
||||||
studiowelcome.qrc
|
studiowelcome.qrc
|
||||||
${qmlQrcFile}
|
|
||||||
"${PROJECT_SOURCE_DIR}/src/share/3rdparty/studiofonts/studiofonts.qrc"
|
"${PROJECT_SOURCE_DIR}/src/share/3rdparty/studiofonts/studiofonts.qrc"
|
||||||
EXTRA_TRANSLATIONS
|
EXTRA_TRANSLATIONS
|
||||||
qml
|
qml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (TARGET StudioWelcome)
|
||||||
|
file(GLOB_RECURSE qmlfiles
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
qml/*
|
||||||
|
)
|
||||||
|
qtc_add_resources(StudioWelcome StudioWelcome_qml FILES ${qmlfiles})
|
||||||
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user