summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/configurejson2cmake.py20
-rw-r--r--util/cmake/helper.py9
-rwxr-xr-xutil/cmake/pro2cmake.py3
3 files changed, 29 insertions, 3 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py
index f1bbcaca3ee..7f7a103ef69 100755
--- a/util/cmake/configurejson2cmake.py
+++ b/util/cmake/configurejson2cmake.py
@@ -225,9 +225,29 @@ def parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set):
# configure.cmake is interested in finding the system library
# for the purpose of enabling or disabling a system_foo feature.
find_package_kwargs["use_system_package_name"] = True
+ find_package_kwargs["module"] = ctx["module"]
cm_fh.write(generate_find_package_info(newlib, **find_package_kwargs))
+ if "use" in data["libraries"][lib]:
+ use_entry = data["libraries"][lib]["use"]
+ if isinstance(use_entry, str):
+ print(f"1use: {use_entry}")
+ cm_fh.write(f"qt_add_qmake_lib_dependency({newlib.soName} {use_entry})\n")
+ else:
+ for use in use_entry:
+ print(f"2use: {use}")
+ indentation = ""
+ has_condition = False
+ if "condition" in use:
+ has_condition = True
+ indentation = " "
+ condition = map_condition(use['condition'])
+ cm_fh.write(f"if({condition})\n")
+ cm_fh.write(f"{indentation}qt_add_qmake_lib_dependency({newlib.soName} {use['lib']})\n")
+ if has_condition:
+ cm_fh.write("endif()\n")
+
run_library_test = False
mapped_library = find_3rd_party_library_mapping(lib)
if mapped_library:
diff --git a/util/cmake/helper.py b/util/cmake/helper.py
index 5dce5b2bf0a..4930b0d1a22 100644
--- a/util/cmake/helper.py
+++ b/util/cmake/helper.py
@@ -778,6 +778,7 @@ def generate_find_package_info(
indent: int = 0,
emit_if: str = "",
use_system_package_name: bool = False,
+ module: str = "",
) -> str:
isRequired = False
@@ -801,8 +802,12 @@ def generate_find_package_info(
package_name = package_name.replace(*replace_args)
cmake_target_name = cmake_target_name.replace(*replace_args)
- if cmake_target_name and use_qt_find_package:
- extra += ["PROVIDED_TARGETS", cmake_target_name]
+ if use_qt_find_package:
+ if cmake_target_name:
+ extra += ["PROVIDED_TARGETS", cmake_target_name]
+ if module:
+ extra += ["MODULE_NAME", module]
+ extra += ["QMAKE_LIB", lib.soName]
result = ""
one_ind = " "
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 1638fede08d..71ef931800b 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -2965,6 +2965,7 @@ def write_3rdparty_library(cm_fh: IO[str], scope: Scope, *, indent: int = 0) ->
target_name = re.sub(r"^qt", "", scope.TARGET)
target_name = target_name.replace("-", "_")
+ qmake_lib_name = target_name
# Capitalize the first letter for a nicer name.
target_name = target_name.title()
@@ -2978,7 +2979,7 @@ def write_3rdparty_library(cm_fh: IO[str], scope: Scope, *, indent: int = 0) ->
else:
library_type = "STATIC"
- extra_lines = []
+ extra_lines = [f"QMAKE_LIB_NAME {qmake_lib_name}"]
if library_type:
extra_lines.append(library_type)