aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Blackquill <uhhadd@gmail.com>2021-02-05 00:09:12 -0500
committerJan Blackquill <uhhadd@gmail.com>2021-02-06 18:48:49 +0000
commitc9d622e878e9c4d2b35325223a919718f0ff0aac (patch)
tree586db90f6914231436fde4758eb6726bb2b7c6a8
parent83b1eaeeeb050a265e388e7709d396bcec68e8e5 (diff)
protobufcpp: add linkLibraries option to disable modifiying linked libs + include paths
This allows one to use Qbs' support for protoc without causing libprotobuf/libgrpc to be linked automatically, which is useful for when you want to build libprotobuf/libgrpc as part of your project. Change-Id: Ia40ebf6d79682b4ed88631f0ea540eeb6aad0bff Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--share/qbs/modules/protobuf/cpp/protobufcpp.qbs19
1 files changed, 15 insertions, 4 deletions
diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
index 47d1a60c1..12d4e159f 100644
--- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
+++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
@@ -12,6 +12,8 @@ ProtobufBase {
property bool useGrpc: false
+ property bool _linkLibraries: true
+
property string grpcIncludePath: grpcIncludeProbe.path
property string grpcLibraryPath: grpcLibraryProbe.path
@@ -33,6 +35,9 @@ ProtobufBase {
}
cpp.libraryPaths: {
+ if (!_linkLibraries)
+ return [];
+
var result = [];
if (libraryPath)
result.push(libraryPath);
@@ -41,6 +46,9 @@ ProtobufBase {
return result;
}
cpp.dynamicLibraries: {
+ if (!_linkLibraries)
+ return [];
+
var result = [];
if (_libraryName)
result.push(_libraryName)
@@ -51,6 +59,9 @@ ProtobufBase {
return result;
}
cpp.includePaths: {
+ if (!_linkLibraries)
+ return [outputDir];
+
var result = [outputDir];
if (includePath)
result.push(includePath);
@@ -118,17 +129,17 @@ ProtobufBase {
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
- if (!HelperFunctions.checkPath(includePath))
+ if (_linkLibraries && !HelperFunctions.checkPath(includePath))
throw "Can't find cpp protobuf include files. Please set the includePath property.";
- if (!HelperFunctions.checkPath(libraryPath))
+ if (_linkLibraries && !HelperFunctions.checkPath(libraryPath))
throw "Can't find cpp protobuf library. Please set the libraryPath property.";
if (useGrpc) {
if (!File.exists(grpcPluginPath))
throw "Can't find grpc_cpp_plugin plugin. Please set the grpcPluginPath property.";
- if (!HelperFunctions.checkPath(grpcIncludePath))
+ if (_linkLibraries && !HelperFunctions.checkPath(grpcIncludePath))
throw "Can't find grpc++ include files. Please set the grpcIncludePath property.";
- if (!HelperFunctions.checkPath(grpcLibraryPath))
+ if (_linkLibraries && !HelperFunctions.checkPath(grpcLibraryPath))
throw "Can't find grpc++ library. Please set the grpcLibraryPath property.";
}
}