From 28af1e508aee74f90f718a082fe4095910e5a731 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 6 Dec 2016 12:44:35 -0800 Subject: Fix propagation of defines to dependencies from QbsLibrary The Export of cpp.defines could not possibly have ever worked as triple equals comparison of a string and array will always be false. Fix that, and then fix the resultant build errors by avoiding the addition of the QBS_STATIC_LIB define to an importing dynamic library, and warning in the case where the same translation unit will be seen with different visibility settings in different contexts. This also fixes warnings in generator plugins due to the different visibility. Change-Id: Icf91bfd5644c436ddea819cce61b7a4b654c0db4 Reviewed-by: Christian Kandeler --- qbs-resources/imports/QbsLibrary.qbs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qbs-resources/imports/QbsLibrary.qbs b/qbs-resources/imports/QbsLibrary.qbs index 5ad01e170..218da8941 100644 --- a/qbs-resources/imports/QbsLibrary.qbs +++ b/qbs-resources/imports/QbsLibrary.qbs @@ -8,13 +8,14 @@ QbsProduct { type: Qt.core.staticBuild ? "staticlibrary" : "dynamiclibrary" targetName: (qbs.enableDebugCode && qbs.targetOS.contains("windows")) ? (name + 'd') : name destinationDirectory: qbs.targetOS.contains("windows") ? "bin" : qbsbuildconfig.libDirName - cpp.defines: base.concat(type == "staticlibrary" ? ["QBS_STATIC_LIB"] : ["QBS_LIBRARY"]) + cpp.defines: base.concat(visibilityType === "static" ? ["QBS_STATIC_LIB"] : ["QBS_LIBRARY"]) cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined // ### Uncomment the following line in 1.8 //cpp.soVersion: version.replace(/\.\d+$/, '') cpp.visibility: "minimal" cpp.cxxLanguageVersion: "c++11" bundle.isBundle: false + property bool visibilityType: Qt.core.staticBuild ? "static" : "dynamic" property string headerInstallPrefix: "/include/qbs" Group { fileTagsFilter: product.type.concat("dynamiclibrary_symlink") @@ -34,6 +35,6 @@ QbsProduct { cpp.rpaths: qbsbuildconfig.libRPaths cpp.includePaths: [product.sourceDirectory] - cpp.defines: product.type === "staticlibrary" ? ["QBS_STATIC_LIB"] : [] + cpp.defines: product.visibilityType === "static" ? ["QBS_STATIC_LIB"] : [] } } -- cgit v1.2.3