From 0bfbe10ff20f271cff0c0af6ca1fb1894bb48d60 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 6 Apr 2020 18:45:19 +0200 Subject: 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 --- util/cmake/pro2cmake.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util/cmake/pro2cmake.py') 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]] -- cgit v1.2.3