aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-04 13:35:45 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-04 13:35:45 -0700
commit42f109d7bcc98e1288b4881fd37734782f7cbab5 (patch)
tree7fcbfc483829208a808769f123cedf5a6c83fd4b /src
parent60c510a381255aa75af7eea1204eafdf22df09f2 (diff)
parent2286ab328c0ca04630193b1d3c1aa8eb5fb7aea3 (diff)
Merge pull request #457 from xfxyjwf/cmake
Add cmake support.
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/testing/googletest.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/google/protobuf/testing/googletest.cc b/src/google/protobuf/testing/googletest.cc
index 64328063..b8bd790b 100644
--- a/src/google/protobuf/testing/googletest.cc
+++ b/src/google/protobuf/testing/googletest.cc
@@ -66,7 +66,14 @@ namespace protobuf {
string TestSourceDir() {
#ifndef GOOGLE_THIRD_PARTY_PROTOBUF
-#ifdef _MSC_VER
+#ifndef _MSC_VER
+ // automake sets the "srcdir" environment variable.
+ char* result = getenv("srcdir");
+ if (result != NULL) {
+ return result;
+ }
+#endif // _MSC_VER
+
// Look for the "src" directory.
string prefix = ".";
@@ -80,16 +87,6 @@ string TestSourceDir() {
}
return prefix + "/src";
#else
- // automake sets the "srcdir" environment variable.
- char* result = getenv("srcdir");
- if (result == NULL) {
- // Otherwise, the test must be run from the source directory.
- return ".";
- } else {
- return result;
- }
-#endif
-#else
return "third_party/protobuf/src";
#endif // GOOGLE_THIRD_PARTY_PROTOBUF
}