pro2cmake.py: Generate .cmake.conf files for versioning

And create one for QtBase at the same time.

Fixes: QTBUG-83835
Change-Id: Icc6b022165a57bd4e22c23bdb0016522b99a5b80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mårten Nordheim 2020-04-28 17:46:21 +02:00
parent 709648993c
commit 6ffe9b1c42
3 changed files with 15 additions and 2 deletions

1
.cmake.conf Normal file
View File

@ -0,0 +1 @@
set(QT_REPO_MODULE_VERSION "6.0.0")

View File

@ -14,8 +14,9 @@ if (CMAKE_CROSSCOMPILING AND CMAKE_SYSROOT)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
endif()
include(".cmake.conf")
project(QtBase
VERSION 6.0.0
VERSION "${QT_REPO_MODULE_VERSION}"
DESCRIPTION "Qt Base Libraries"
HOMEPAGE_URL "https://qt.io/"
LANGUAGES CXX C ASM

View File

@ -3846,8 +3846,9 @@ def handle_top_level_repo_project(scope: Scope, cm_fh: IO[str]):
f"""\
cmake_minimum_required(VERSION {cmake_version_string})
include(.cmake.conf)
project({qt_lib}
VERSION 6.0.0
VERSION "${{QT_REPO_MODULE_VERSION}}"
DESCRIPTION "Qt {qt_lib_no_prefix} Libraries"
HOMEPAGE_URL "https://qt.io/"
LANGUAGES CXX C
@ -3868,6 +3869,15 @@ def handle_top_level_repo_project(scope: Scope, cm_fh: IO[str]):
cm_fh.write(f"{header}{expand_project_requirements(scope)}{build_repo}")
def create_top_level_cmake_conf():
conf_file_name = ".cmake.conf"
try:
with open(conf_file_name, 'x') as file:
file.write("set(QT_REPO_MODULE_VERSION \"6.0.0\")\n")
except FileExistsError as _:
pass
def find_top_level_repo_project_file(project_file_path: str = "") -> Optional[str]:
qmake_conf_path = find_qmake_conf(project_file_path)
qmake_dir = os.path.dirname(qmake_conf_path)
@ -4034,6 +4044,7 @@ def cmakeify_scope(
# Handle top level repo project in a special way.
if is_top_level_repo_project(scope.file_absolute_path):
create_top_level_cmake_conf()
handle_top_level_repo_project(scope, temp_buffer)
# Same for top-level tests.
elif is_top_level_repo_tests_project(scope.file_absolute_path):