Skip to content

Commit 45b5935

Browse files
committed
CMake: Modernize the CMake code
Instead of including just QtSetup, rely on qt_build_repo() like the rest of our repos. Because qt_build_repo does not automatically add the translations subdirectory for processing, create a src subdirectory that is auto-loaded by qt_build_repo. Add the translations subdirectory to the src subdirectory. This is needed for proper SBOM document generation which relies on qt_build_repo being called. Clean up some of the outdated comments left over from the qmake porting. Task-number: QTBUG-122899 Task-number: QTBUG-128320 Change-Id: I3b60393b162066dd2c2df2e9b1d45cb5f1fbd493 Reviewed-by: Joerg Bornemann <[email protected]>
1 parent 0c9efa0 commit 45b5935

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

CMakeLists.txt

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Copyright (C) 2022 The Qt Company Ltd.
1+
# Copyright (C) 2024 The Qt Company Ltd.
22
# SPDX-License-Identifier: BSD-3-Clause
33

44
cmake_minimum_required(VERSION 3.16)
55

66
include(.cmake.conf)
77
project(QtTranslations
88
VERSION "${QT_REPO_MODULE_VERSION}"
9-
DESCRIPTION "Qt Translations"
9+
DESCRIPTION "QtTranslations"
1010
HOMEPAGE_URL "https://qt.io/"
1111
LANGUAGES CXX C
1212
)
@@ -17,12 +17,5 @@ set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
1717
set(QT_REPO_NOT_WARNINGS_CLEAN TRUE)
1818
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
1919
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Linguist)
20-
qt_internal_project_setup()
2120

22-
include(QtSetup) # for qt_install
23-
24-
if(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::lupdate AND TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::lconvert)
25-
add_subdirectory(translations)
26-
else()
27-
message(STATUS "Skipping adding translation custom targets due to missing lupdate or lconvert.")
28-
endif()
21+
qt_build_repo()

src/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (C) 2024 The Qt Company Ltd.
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
if(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::lupdate AND TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::lconvert)
5+
add_subdirectory(../translations translations)
6+
else()
7+
message(STATUS "Skipping adding translation custom targets due to missing lupdate or lconvert.")
8+
endif()

0 commit comments

Comments
 (0)