diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-07 18:13:53 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-08 08:23:06 +0000 |
commit | 44c9ad561799b51c1e4d10c8b9821fbff6143ef1 (patch) | |
tree | 1995f3a7331ab5cc547b89409354d239dc8ab99f | |
parent | 38b1474c516810b7c1bef8d660ff594817f1cf08 (diff) |
Improve pro2cmake.py more
Fix incorrect usage of CMAKE_CURRENT_BUILD_DIR, there is no such
CMake variable, it's actually CMAKE_CURRENT_BINARY_DIR.
Also if the host_build option is set when building a module,
the library should be a static library.
Change-Id: I9fb39905118dbd7f33d9821960eaed11f20b30c6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rwxr-xr-x | util/cmake/pro2cmake.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 0de5fce559..94c7965638 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -601,9 +601,9 @@ class Scope(object): return ['${CMAKE_CURRENT_SOURCE_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] if key == 'OUT_PWD': if is_same_path: - return ['${CMAKE_CURRENT_BUILD_DIR}'] + return ['${CMAKE_CURRENT_BINARY_DIR}'] else: - return ['${CMAKE_CURRENT_BUILD_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] + return ['${CMAKE_CURRENT_BINARY_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] return self._evalOps(key, None, [], inherrit=inherrit) @@ -1603,7 +1603,12 @@ def write_module(cm_fh: typing.IO[str], scope: Scope, *, print('XXXXXX Module name {} does not start with Qt!'.format(module_name)) extra = [] - if 'static' in scope.get('CONFIG'): + + # A module should be static when 'static' is in CONFIG + # or when option(host_build) is used, as described in qt_module.prf. + is_static = 'static' in scope.get('CONFIG') or 'host_build' in scope.get('_OPTION') + + if is_static: extra.append('STATIC') if 'internal_module' in scope.get('CONFIG'): extra.append('INTERNAL_MODULE') |