summaryrefslogtreecommitdiff
path: root/src/tools/dumpqmltypes/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/dumpqmltypes/CMakeLists.txt')
-rw-r--r--src/tools/dumpqmltypes/CMakeLists.txt50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/tools/dumpqmltypes/CMakeLists.txt b/src/tools/dumpqmltypes/CMakeLists.txt
index bd1a9d4e..3739768e 100644
--- a/src/tools/dumpqmltypes/CMakeLists.txt
+++ b/src/tools/dumpqmltypes/CMakeLists.txt
@@ -1,8 +1,6 @@
-qt_get_tool_target_name(target_name appman-dumpqmltypes)
-qt_internal_add_tool(${target_name}
+qt_internal_add_app(appman-dumpqmltypes
EXCEPTIONS
- TOOLS_TARGET AppManMainPrivate
SOURCES
dumpqmltypes.cpp
LIBRARIES
@@ -21,6 +19,26 @@ qt_internal_add_tool(${target_name}
AM_COMPILING_APPMAN
)
+# regenerate the qmltypes, if possible
+if(NOT QT_FEATURE_cross_compile)
+ qt_internal_collect_command_environment(env_path env_plugin_path)
+
+ # We have to set the env to get the PATH set to find the Qt libraries
+ # needed by the appman-dumpqmltypes binary (we cannot guarantee that the
+ # target is in $QTDIR/bin)
+
+ add_custom_command(
+ TARGET appman-dumpqmltypes
+ POST_BUILD
+ BYPRODUCTS "qmltypes"
+ COMMAND "${CMAKE_COMMAND}" -E env "PATH=${env_path}${QT_PATH_SEPARATOR}$ENV{PATH}"
+ "$<TARGET_FILE:appman-dumpqmltypes>" "${CMAKE_SOURCE_DIR}/qmltypes"
+ COMMENT "Generating qmltypes using appman-dumpqmltypes"
+ VERBATIM
+ )
+endif()
+
+# install the qmltypes
set(qml_install_dir "${INSTALL_QMLDIR}")
qt_path_join(qml_install_dir ${QT_INSTALL_DIR} ${qml_install_dir})
@@ -30,31 +48,11 @@ if(QT_WILL_INSTALL)
DESTINATION "${qml_install_dir}"
)
else()
- set(COPY_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/qmltypes" "${qml_install_dir}")
-endif()
-
-if(TARGET ${target_name} AND NOT QT_FEATURE_cross_compile)
- qt_internal_collect_command_environment(env_path env_plugin_path)
-
- # We have to set the env to get the PATH set to find the Qt libraries
- # needed by the appman-dumpqmltypes binary (we cannot guarantee that the
- # target is in $QTDIR/bin)
- # In addition $<TARGET_FILE:...> will result in a broken path to the
- # tool in a multi-config build, because Qt only builds the tools once.
- # Hence we need to construct the path to the tool ourselves (copied from
- # QtToolHelpers.cmake)
-
- set(tool_path "${QT_BUILD_DIR}/${INSTALL_BINDIR}/appman-dumpqmltypes")
-
add_custom_command(
- TARGET ${target_name}
+ TARGET appman-dumpqmltypes
POST_BUILD
- BYPRODUCTS "qmltypes"
- COMMAND "${CMAKE_COMMAND}" -E env "PATH=${env_path}${QT_PATH_SEPARATOR}$ENV{PATH}"
- "${tool_path}" "${CMAKE_SOURCE_DIR}/qmltypes"
- ${COPY_COMMAND}
- DEPENDS "${tool_path}"
- COMMENT "Generating qmltypes using ${tool_path}"
+ COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_SOURCE_DIR}/qmltypes" "${qml_install_dir}"
+ COMMENT "Copying qmltypes to Qt directory"
VERBATIM
)
endif()