summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-10-10 15:40:38 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-10-10 14:15:06 +0000
commit6167031ecc3c5bac924ca8deb469cf3dc6886704 (patch)
tree26d9fa43e8971ee4d8c4a6e68feee3f4bec45ef6 /util
parent441a9f562e8f82e492ad6eb94bb12069f28e3b15 (diff)
Add 'add_cmake_library' to QtBuild.cmake
Add add_cmake_library to allow us to create normal cmake targets using all the information we have collected via the conversion script. This function is only meant for tests. For an example, see tests/auto/corelib/plugin/qpluginloader/lib/lib.pro. Change-Id: I738cb8ac241b8da1a1da3ef957c24dc7a754d43f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 475ff6affa..d7e521ff30 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -2421,6 +2421,42 @@ def write_main_part(
cm_fh.write(ignored_keys_report)
+def write_generic_library(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str:
+
+ target_name = scope.TARGET
+
+ library_type = ""
+
+ if 'dll' in scope.get('CONFIG'):
+ library_type = "SHARED"
+
+ if 'static' in scope.get('CONFIG'):
+ library_type = "STATIC"
+
+ extra_lines = []
+
+ if library_type:
+ extra_lines.append(library_type)
+
+ target_path = scope.expandString('target.path')
+ target_path = replace_path_constants(target_path, scope)
+ if target_path:
+ extra_lines.append(f'INSTALL_DIRECTORY "{target_path}"')
+
+ write_main_part(
+ cm_fh,
+ target_name,
+ "Generic Library",
+ "add_cmake_library",
+ scope,
+ extra_lines=extra_lines,
+ indent=indent,
+ known_libraries={},
+ extra_keys=[],
+ )
+
+ return target_name
+
def write_module(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str:
module_name = scope.TARGET
if not module_name.startswith("Qt"):
@@ -2921,9 +2957,12 @@ def handle_app_or_lib(
elif is_plugin:
assert not is_example
target = write_plugin(cm_fh, scope, indent=indent)
- elif is_lib or "qt_module" in scope.get("_LOADED"):
+ elif is_lib and "qt_module" in scope.get("_LOADED"):
assert not is_example
target = write_module(cm_fh, scope, indent=indent)
+ elif is_lib:
+ assert not is_example
+ target = write_generic_library(cm_fh, scope, indent=indent)
elif "qt_tool" in scope.get("_LOADED"):
assert not is_example
target = write_tool(cm_fh, scope, indent=indent)