aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-06-26 14:57:40 -0700
committerGravatar GitHub <noreply@github.com>2018-06-26 14:57:40 -0700
commitd03050653ff84e624def93aa512ef35907f5792a (patch)
treecef0fb6ef7e28a3302e1578f83a8fd8d57099eba /cmake
parentae7078ca2bdd362df43e5fdba0261c5c84c1b447 (diff)
Install googletest (#1461)
Also add FindGMock to Find gmock after installation
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGMock.cmake47
-rw-r--r--cmake/external/googletest.cmake7
2 files changed, 50 insertions, 4 deletions
diff --git a/cmake/FindGMock.cmake b/cmake/FindGMock.cmake
new file mode 100644
index 0000000..76ce227
--- /dev/null
+++ b/cmake/FindGMock.cmake
@@ -0,0 +1,47 @@
+# Copyright 2018 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include(FindPackageHandleStandardArgs)
+
+find_path(
+ GMOCK_INCLUDE_DIR gmock/gmock.h
+ HINTS ${FIREBASE_INSTALL_DIR}/include
+)
+
+find_library(
+ GMOCK_LIBRARY
+ NAMES gmock
+ HINTS ${FIREBASE_INSTALL_DIR}/lib
+)
+
+find_package_handle_standard_args(
+ gmock
+ DEFAULT_MSG
+ GMOCK_INCLUDE_DIR
+ GMOCK_LIBRARY
+)
+
+if(GMOCK_FOUND)
+ set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
+ set(GMOCK_LIBRARIES ${GMOCK_LIBRARY})
+
+ if (NOT TARGET GMock::GMock)
+ add_library(GMock::GMock UNKNOWN IMPORTED)
+ set_target_properties(
+ GMock::GMock PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${GMOCK_INCLUDE_DIRS}
+ IMPORTED_LOCATION ${GMOCK_LIBRARY}
+ )
+ endif()
+endif(GMOCK_FOUND)
diff --git a/cmake/external/googletest.cmake b/cmake/external/googletest.cmake
index f48c357..3af136e 100644
--- a/cmake/external/googletest.cmake
+++ b/cmake/external/googletest.cmake
@@ -24,10 +24,9 @@ ExternalProject_Add(
PREFIX ${PROJECT_BINARY_DIR}/external/googletest
- # Just download the sources without building.
+ CMAKE_CACHE_ARGS
+ -DCMAKE_INSTALL_PREFIX:STRING=${FIREBASE_INSTALL_DIR}
+
UPDATE_COMMAND ""
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
TEST_COMMAND ""
)