From 4333edb34048d29a410cc247ff7ffbad8145132f Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Sun, 31 May 2015 02:28:34 -0700 Subject: Add cmake support. --- src/google/protobuf/testing/googletest.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/google/protobuf/testing') 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 = "."; @@ -79,16 +86,6 @@ string TestSourceDir() { prefix += "/.."; } 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 -- cgit v1.2.3