diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-03-31 14:12:01 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-04-01 21:19:35 +0200 |
commit | 7909de1bebe3bac32286513025fc00220cd29ec1 (patch) | |
tree | c72354cc0468e47e81c344c6f1a6452b744c7fc0 /util/cmake/configurejson2cmake.py | |
parent | c20f23e03b3208f445202f5b071f0b62de1b7d01 (diff) |
CMake: Define QT_STATIC for static builds
QT_STATIC must be defined for static builds to have the right
import/export symbol macros defined. Originally, this macro is wrapped
in a condition. That's why we extend qt_feature_definition to be able
to write a prerequisite to qconfig.h.
Change-Id: I610e60acc7f5bdc031eff6d53a76e0b229a5c8c2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util/cmake/configurejson2cmake.py')
-rwxr-xr-x | util/cmake/configurejson2cmake.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index ec734a9ef8..8887adb22b 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -827,7 +827,20 @@ def get_feature_mapping(): "sanitizer": None, "sanitize_thread": None, "sanitize_undefined": None, - "shared": {"condition": "BUILD_SHARED_LIBS"}, + "shared": { + "condition": "BUILD_SHARED_LIBS", + "output": [ + "publicFeature", + "publicQtConfig", + "publicConfig", + { + "type": "define", + "name": "QT_STATIC", + "prerequisite": "!defined(QT_SHARED) && !defined(QT_STATIC)", + "negative": True + } + ] + }, "silent": None, "sql-sqlite": {"condition": "QT_FEATURE_datestring"}, "static": None, @@ -1050,6 +1063,8 @@ def parseFeature(ctx, feature, data, cm_fh): cm_fh.write(" NEGATE") if outputArgs.get("value") is not None: cm_fh.write(f' VALUE "{outputArgs.get("value")}"') + if outputArgs.get("prerequisite") is not None: + cm_fh.write(f' PREREQUISITE "{outputArgs.get("prerequisite")}"') cm_fh.write(")\n") # Write qt_feature_config() calls |