Skip to content

Commit

Permalink
pro2cmake.py: Generate .cmake.conf files for versioning
Browse files Browse the repository at this point in the history
And create one for QtBase at the same time.

Fixes: QTBUG-83835
Change-Id: Icc6b022165a57bd4e22c23bdb0016522b99a5b80
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
Morten242 committed Apr 30, 2020
1 parent 7096489 commit 6ffe9b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .cmake.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(QT_REPO_MODULE_VERSION "6.0.0")
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion util/cmake/pro2cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 6ffe9b1

Please sign in to comment.