summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-04-06 18:45:19 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-04-07 23:22:33 +0200
commit0bfbe10ff20f271cff0c0af6ca1fb1894bb48d60 (patch)
tree56f57fa952cf133e3a91aa318625515058f65fca /util/cmake/pro2cmake.py
parent5c9ab44ff6e3c2cda7738cfba5ab32f4be174ef2 (diff)
CMake: Implement proper exclusion of tools including installing
The previous approach didn't work for prefix builds. While a target might be excluded from building via EXCLUDE_FROM_ALL property, when calling make install it would still try to install the target and thus fail. It's not possible to modify an install() command in a post-processing step, so we switch the semantics around. pro2cmake will now write a qt_exclude_tool_directories_from_default_target() call before adding subdirectories. This will set an internal variable with a list of the given subdirectories, which is checked by qt_add_executable. If the current source dir matches one of the given subdirectories, the EXCLUDE_FROM_ALL property is set both for the target and the qt_install() command. This should fix the failing Android prefix builds of qttools. Amends 622894f96e93d62147a28a6f37b7ee6a90d74042 Change-Id: Ia19323a2ef72a3fb9cb752ad2d4f2742269d11c4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index c64f7f5b56..ae46277293 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1800,8 +1800,8 @@ def handle_subdir(
handle_subdir_helper(
scope, cm_fh, indent=indent, current_conditions=current_conditions, is_example=is_example
)
- group_and_print_sub_dirs(scope, indent=indent)
+ # Make sure to exclude targets within subdirectories first.
qt_no_make_tools = scope.get("_QT_NO_MAKE_TOOLS")
if qt_no_make_tools:
ind = spaces(indent + 1)
@@ -1812,6 +1812,9 @@ def handle_subdir(
f"\nqt_exclude_tool_directories_from_default_target(\n{directories_string})\n\n"
)
+ # Then write the subdirectories.
+ group_and_print_sub_dirs(scope, indent=indent)
+
def sort_sources(sources: List[str]) -> List[str]:
to_sort = {} # type: Dict[str, List[str]]