summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Queiro <overdrigzed@gmail.com>2018-01-04 12:00:27 +0100
committerGitHub <noreply@github.com>2018-01-04 12:00:27 +0100
commit5b1aa94e4b7cb47347b979e7dc8709370d8d6272 (patch)
treea284433da7af5e4eb7b2d1c115a855a8afab5938
parentbffb4a6ee2d6bed1701d57094e3c6fd76d714c16 (diff)
parent3efe9e402532411b1271acfc8b1cf6186db119fa (diff)
downloadglog-5b1aa94e4b7cb47347b979e7dc8709370d8d6272.tar.gz
glog-5b1aa94e4b7cb47347b979e7dc8709370d8d6272.tar.bz2
glog-5b1aa94e4b7cb47347b979e7dc8709370d8d6272.zip
Merge pull request #276 from drigz/add-example
Add an example using glog from Bazel
-rw-r--r--bazel/example/BUILD8
-rw-r--r--bazel/example/main.cc14
2 files changed, 22 insertions, 0 deletions
diff --git a/bazel/example/BUILD b/bazel/example/BUILD
new file mode 100644
index 0000000..6b10e2b
--- /dev/null
+++ b/bazel/example/BUILD
@@ -0,0 +1,8 @@
+cc_test(
+ name = "main",
+ size = "small",
+ srcs = ["main.cc"],
+ deps = [
+ "//:glog",
+ ],
+)
diff --git a/bazel/example/main.cc b/bazel/example/main.cc
new file mode 100644
index 0000000..da5c020
--- /dev/null
+++ b/bazel/example/main.cc
@@ -0,0 +1,14 @@
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+
+int main(int argc, char* argv[]) {
+ // Initialize Google's logging library.
+ google::InitGoogleLogging(argv[0]);
+
+ // Optional: parse command line flags
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
+
+ LOG(INFO) << "Hello, world!";
+
+ return 0;
+}