diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-04-28 17:46:21 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-04-30 17:44:03 +0000 |
commit | 6ffe9b1c42267eaf0fc81d16931e1a6f9f39879d (patch) | |
tree | 1691c9ce5f70ffda8f3d9afd25a9f4785c86f304 /util/cmake/pro2cmake.py | |
parent | 709648993c1ea5f6b46ebe8bfd0f27d75c9b4e95 (diff) |
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>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-x | util/cmake/pro2cmake.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 89d8412448..48bb8b7d88 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -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): |