diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-04-24 10:09:46 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-04-24 14:55:32 +0000 |
commit | f86d8c72103e45e68a681c8e5f0bd91fef758141 (patch) | |
tree | ac3a89a8ce17de66f3577f35bfa6ba8650b627b7 /src | |
parent | 254e13ee98bb551ac3882596d71b3a9c081cd11f (diff) | |
download | qbs-f86d8c72103e45e68a681c8e5f0bd91fef758141.tar.gz |
Fix build for configuration that enables tests, but disables unit tests
It's probably not worth adding an extra export macro for that, so just
enable QBS_AUTOTEST_EXPORT if any tests are enabled.
Amends b3509323a4552eb1c4a43218cb715904400d0d62.
Change-Id: I3573ae59de98f192d6ae3630b973857f911b3eaa
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/corelib/corelib.qbs | 21 | ||||
-rw-r--r-- | src/lib/corelib/tools/qbs_export.h | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index f33c483da..358e6e353 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -14,14 +14,19 @@ QbsLibrary { ".", "../.." // for the plugin headers ]) - property stringList enableUnitTestsDefines: - qbsbuildconfig.enableUnitTests ? ["QBS_ENABLE_UNIT_TESTS"] : [] - property stringList systemSettingsDirDefines: qbsbuildconfig.systemSettingsDir - ? ['QBS_SYSTEM_SETTINGS_DIR="' + qbsbuildconfig.systemSettingsDir + '"'] : [] - cpp.defines: base.concat([ - "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), - "QBS_VERSION=" + Utilities.cStringQuote(version), - ]).concat(enableUnitTestsDefines).concat(systemSettingsDirDefines) + cpp.defines: { + var defines = base.concat([ + "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), + "QBS_VERSION=" + Utilities.cStringQuote(version), + ]); + if (project.withTests) + defines.push("QBS_WITH_TESTS"); + if (qbsbuildconfig.enableUnitTests) + defines.push("QBS_ENABLE_UNIT_TESTS"); + if (qbsbuildconfig.systemSettingsDir) + defines.push('QBS_SYSTEM_SETTINGS_DIR="' + qbsbuildconfig.systemSettingsDir + '"'); + return defines; + } Properties { condition: qbs.targetOS.contains("windows") diff --git a/src/lib/corelib/tools/qbs_export.h b/src/lib/corelib/tools/qbs_export.h index 164aa4184..2cfe1cd82 100644 --- a/src/lib/corelib/tools/qbs_export.h +++ b/src/lib/corelib/tools/qbs_export.h @@ -53,14 +53,14 @@ #else # ifdef QBS_LIBRARY # define QBS_EXPORT QBS_DECL_EXPORT -# ifdef QBS_ENABLE_UNIT_TESTS +# ifdef QBS_WITH_TESTS # define QBS_AUTOTEST_EXPORT QBS_DECL_EXPORT # else # define QBS_AUTOTEST_EXPORT # endif # else # define QBS_EXPORT QBS_DECL_IMPORT -# ifdef QBS_ENABLE_UNIT_TESTS +# ifdef QBS_WITH_TESTS # define QBS_AUTOTEST_EXPORT QBS_DECL_IMPORT # else # define QBS_AUTOTEST_EXPORT |